mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	chore(demo): move to right directory
This commit is contained in:
		| @@ -0,0 +1,10 @@ | ||||
| // will add a launcher to the left sidebar | ||||
| api.createOrUpdateLauncher({ | ||||
|     id: 'taskmanager', | ||||
|     type: 'script', | ||||
|     title: 'New task', | ||||
|     icon: 'bx-task', | ||||
|     keyboardShortcut: 'alt+n', | ||||
|     scriptNoteId: api.currentNote.getRelationValue('createNewTask'), | ||||
|     isVisible: true | ||||
| }); | ||||
| @@ -0,0 +1,27 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy a board game for Alice</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy a board game for Alice</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <figure class="image image-style-side"> | ||||
|           <img style="aspect-ratio:209/300;" src="Buy a board game for Alice.jpg" | ||||
|           width="209" height="300"> | ||||
|         </figure> | ||||
|         <p>Maybe CodeNames? <a href="https://boardgamegeek.com/boardgame/178900/codenames">https://boardgamegeek.com/boardgame/178900/codenames</a> | ||||
|  | ||||
|         </p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 7.0 KiB | 
| @@ -0,0 +1,19 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Dentist appointment</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Dentist appointment</h1> | ||||
|  | ||||
|       <div class="ck-content"></div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Get a gym membership</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Get a gym membership</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>Just in time for new years resolution!</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,7 @@ | ||||
| span.fancytree-node.todo .fancytree-title { | ||||
|     color: red !important; | ||||
| } | ||||
|  | ||||
| span.fancytree-node.done .fancytree-title { | ||||
|     color: green !important; | ||||
| } | ||||
| @@ -0,0 +1,63 @@ | ||||
| if (!["task", "location", "tag", "todoDate", "doneDate"].includes(api.originEntity.name)) { | ||||
|     return; | ||||
| } | ||||
|  | ||||
| const tagRootNote = api.getNoteWithLabel('taskTagRoot'); | ||||
| const doneRootNote = api.getNoteWithLabel('taskDoneRoot'); | ||||
| const todoRootNote = api.getNoteWithLabel('taskTodoRoot'); | ||||
|  | ||||
| if (!tagRootNote || !doneRootNote || !todoRootNote) { | ||||
|     console.log("One of the tagRootNote, doneRootNote or todoRootNote does not exist"); | ||||
|     return; | ||||
| } | ||||
|  | ||||
| const note = api.originEntity.getNote(); | ||||
|  | ||||
| if (note.isDeleted) { | ||||
|     return; | ||||
| } | ||||
|      | ||||
| const attributes = note.getAttributes(); | ||||
|  | ||||
| const todoDate = note.getLabelValue('todoDate'); | ||||
| const doneDate = note.getLabelValue('doneDate'); | ||||
|  | ||||
| function isWithinExpectedRange(date) { | ||||
|     if (!date) { | ||||
|         return true; | ||||
|     } | ||||
|      | ||||
|     const year = parseInt(date.substr(0, 4)); | ||||
|      | ||||
|     return year >= 2010 && year < 2050; | ||||
| } | ||||
|  | ||||
| if (!isWithinExpectedRange(todoDate) || !isWithinExpectedRange(doneDate)) { | ||||
|     console.log(`One or both dates - ${todoDate}, ${doneDate} - is outside of expected range`); | ||||
|      | ||||
|     return; | ||||
| } | ||||
|  | ||||
| const isTaskDone = !!doneDate; | ||||
|  | ||||
| api.toggleNoteInParent(isTaskDone, note.noteId, doneRootNote.noteId); | ||||
| api.toggleNoteInParent(!isTaskDone, note.noteId, todoRootNote.noteId); | ||||
|  | ||||
| const location = note.getLabelValue('location'); | ||||
| const locationRootNote = api.getNoteWithLabel('taskLocationRoot'); | ||||
|  | ||||
| reconcileAssignments(note, locationRootNote, location ? [location] : [], 'taskLocationNote', isTaskDone); | ||||
|  | ||||
| const tags = attributes.filter(attr => attr.type === 'label' && attr.name === 'tag').map(attr => attr.value); | ||||
|  | ||||
| reconcileAssignments(note, tagRootNote, tags, 'taskTagNote', isTaskDone); | ||||
|  | ||||
| note.toggleLabel(isTaskDone, "cssClass", "done"); | ||||
|  | ||||
| const doneTargetNoteId = isTaskDone ?  api.getDayNote(doneDate).noteId : null; | ||||
| api.setNoteToParent(note.noteId, 'DONE', doneTargetNoteId); | ||||
|  | ||||
| note.toggleLabel(!isTaskDone, "cssClass", "todo"); | ||||
|  | ||||
| const todoTargetNoteId = (!isTaskDone && todoDate) ? api.getDayNote(todoDate).noteId : null; | ||||
| api.setNoteToParent(note.noteId, 'TODO', todoTargetNoteId); | ||||
| @@ -0,0 +1,25 @@ | ||||
| module.exports = function (note, categoryRootNote, assignedCategories, labelName, isTaskDone) { | ||||
|     const found = {}; | ||||
|      | ||||
|     for (const categoryNote of categoryRootNote.getChildNotes()) { | ||||
|         const label = categoryNote.getLabel(labelName); | ||||
|          | ||||
|         if (label) { | ||||
|             found[label.value] = !isTaskDone && assignedCategories.includes(label.value); | ||||
|  | ||||
|             api.toggleNoteInParent(found[label.value], note.noteId, categoryNote.noteId); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     if (!isTaskDone) { | ||||
|         for (const assignedCategory of assignedCategories) { | ||||
|             if (!found[assignedCategory]) { | ||||
|                 const categoryNote = api.createTextNote(categoryRootNote.noteId, assignedCategory, "").note; | ||||
|                  | ||||
|                 categoryNote.addLabel(labelName, assignedCategory); | ||||
|  | ||||
|                 api.ensureNoteIsPresentInParent(note.noteId, categoryNote.noteId); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,14 @@ | ||||
| // creating notes is backend (server) responsibility so we need to pass | ||||
| // the control there | ||||
| const taskNoteId = await api.runOnBackend(() => { | ||||
|     const todoRootNote = api.getNoteWithLabel('taskTodoRoot'); | ||||
|     const resp = api.createTextNote(todoRootNote.noteId, 'new task', ''); | ||||
|  | ||||
|     return resp.note.noteId; | ||||
| }); | ||||
|  | ||||
| // wait until the frontend is fully synced with the changes made on the backend above | ||||
| await api.waitUntilSynced(); | ||||
|  | ||||
| // we got an ID of newly created note and we want to immediatelly display it | ||||
| await api.activateNewNote(taskNoteId); | ||||
| @@ -0,0 +1,19 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>task template</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>task template</h1> | ||||
|  | ||||
|       <div class="ck-content"></div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,19 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>gym</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>gym</h1> | ||||
|  | ||||
|       <div class="ck-content"></div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy some book for Bob</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy some book for Bob</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>Bob likes to read popular science books so something like that…</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,30 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Maybe Black Swan?</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Maybe Black Swan?</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p><a href="https://en.wikipedia.org/wiki/The_Black_Swan:_The_Impact_of_the_Highly_Improbable">https://en.wikipedia.org/wiki/The_Black_Swan:_The_Impact_of_the_Highly_Improbable</a> | ||||
|  | ||||
|         </p> | ||||
|         <p><em><strong>The Black Swan: The Impact of the Highly Improbable</strong></em> is | ||||
|           a 2007 book by author and former <a href="https://en.wikipedia.org/wiki/Options_trader">options trader</a>  | ||||
|           <a | ||||
|           href="https://en.wikipedia.org/wiki/Nassim_Nicholas_Taleb">Nassim Nicholas Taleb</a>. The book focuses on the extreme impact of rare | ||||
|             and unpredictable <a href="https://en.wikipedia.org/wiki/Outlier">outlier</a> events | ||||
|             — and the human tendency to find simplistic explanations for these events, | ||||
|             retrospectively. Taleb calls this the <a href="https://en.wikipedia.org/wiki/Black_Swan_theory">Black Swan theory</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,19 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy milk</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy milk</h1> | ||||
|  | ||||
|       <div class="ck-content"></div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,19 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Send invites for christmas party</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Send invites for christmas party</h1> | ||||
|  | ||||
|       <div class="ck-content"></div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy milk</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy milk</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>This is a clone of a note. Go to its <a href="../Locations/tesco/Buy%20milk.html">primary location</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy some book for Bob</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy some book for Bob</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>This is a clone of a note. Go to its <a href="../Locations/mall/Buy%20some%20book%20for%20Bob.html">primary location</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Send invites for christmas party</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Send invites for christmas party</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>This is a clone of a note. Go to its <a href="../Locations/work/Send%20invites%20for%20christmas%20par.html">primary location</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy some book for Bob</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy some book for Bob</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>This is a clone of a note. Go to its <a href="../../Locations/mall/Buy%20some%20book%20for%20Bob.html">primary location</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy milk</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy milk</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>This is a clone of a note. Go to its <a href="../../Locations/tesco/Buy%20milk.html">primary location</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,19 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>health</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>health</h1> | ||||
|  | ||||
|       <div class="ck-content"></div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy milk</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy milk</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>This is a clone of a note. Go to its <a href="../../Locations/tesco/Buy%20milk.html">primary location</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
| @@ -0,0 +1,21 @@ | ||||
| <html> | ||||
|    | ||||
|   <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="../../../../../../style.css"> | ||||
|     <base target="_parent"> | ||||
|     <title data-trilium-title>Buy some book for Bob</title> | ||||
|   </head> | ||||
|    | ||||
|   <body> | ||||
|     <div class="content"> | ||||
|        <h1 data-trilium-h1>Buy some book for Bob</h1> | ||||
|  | ||||
|       <div class="ck-content"> | ||||
|         <p>This is a clone of a note. Go to its <a href="../../Locations/mall/Buy%20some%20book%20for%20Bob.html">primary location</a>.</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </body> | ||||
|  | ||||
| </html> | ||||
		Reference in New Issue
	
	Block a user