mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	removed all onclick handlers from index template
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const attributesDialog = (function() { | ||||
|     const $showDialogButton = $(".show-attributes-button"); | ||||
|     const $dialog = $("#attributes-dialog"); | ||||
|     const $saveAttributesButton = $("#save-attributes-button"); | ||||
|     const $attributesBody = $('#attributes-table tbody'); | ||||
| @@ -218,6 +219,8 @@ const attributesDialog = (function() { | ||||
|         $(this).autocomplete("search", $(this).val()); | ||||
|     }); | ||||
|  | ||||
|     $showDialogButton.click(showDialog); | ||||
|  | ||||
|     return { | ||||
|         showDialog | ||||
|     }; | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const jumpToNote = (function() { | ||||
|     const $showDialogButton = $("#jump-to-note-button"); | ||||
|     const $dialog = $("#jump-to-note-dialog"); | ||||
|     const $autoComplete = $("#jump-to-note-autocomplete"); | ||||
|     const $form = $("#jump-to-note-form"); | ||||
| @@ -50,6 +51,8 @@ const jumpToNote = (function() { | ||||
|         return false; | ||||
|     }); | ||||
|  | ||||
|     $showDialogButton.click(showDialog); | ||||
|  | ||||
|     return { | ||||
|         showDialog | ||||
|     }; | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const noteHistory = (function() { | ||||
|     const $showDialogButton = $("#show-history-button"); | ||||
|     const $dialog = $("#note-history-dialog"); | ||||
|     const $list = $("#note-history-list"); | ||||
|     const $content = $("#note-history-content"); | ||||
| @@ -72,6 +73,8 @@ const noteHistory = (function() { | ||||
|         return false; | ||||
|     }); | ||||
|  | ||||
|     $showDialogButton.click(showCurrentNoteHistory); | ||||
|  | ||||
|     return { | ||||
|         showCurrentNoteHistory | ||||
|     }; | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const noteSource = (function() { | ||||
|     const $showDialogButton = $("#show-source-button"); | ||||
|     const $dialog = $("#note-source-dialog"); | ||||
|     const $noteSource = $("#note-source"); | ||||
|  | ||||
| @@ -51,6 +52,8 @@ const noteSource = (function() { | ||||
|         e.preventDefault(); | ||||
|     }); | ||||
|  | ||||
|     $showDialogButton.click(showDialog); | ||||
|  | ||||
|     return { | ||||
|         showDialog | ||||
|     }; | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const recentChanges = (function() { | ||||
|     const $showDialogButton = $("#recent-changes-button"); | ||||
|     const $dialog = $("#recent-changes-dialog"); | ||||
|  | ||||
|     async function showDialog() { | ||||
| @@ -83,6 +84,8 @@ const recentChanges = (function() { | ||||
|  | ||||
|     $(document).bind('keydown', 'alt+r', showDialog); | ||||
|  | ||||
|     $showDialogButton.click(showDialog); | ||||
|  | ||||
|     return { | ||||
|         showDialog | ||||
|     }; | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const recentNotes = (function() { | ||||
|     const $showDialogButton = $("#recent-notes-button"); | ||||
|     const $dialog = $("#recent-notes-dialog"); | ||||
|     const $searchInput = $('#recent-notes-search-input'); | ||||
|  | ||||
| @@ -94,6 +95,8 @@ const recentNotes = (function() { | ||||
|         e.preventDefault(); | ||||
|     }); | ||||
|  | ||||
|     $showDialogButton.click(showDialog); | ||||
|  | ||||
|     return { | ||||
|         showDialog, | ||||
|         addRecentNote, | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| "use strict"; | ||||
|  | ||||
| const settings = (function() { | ||||
|     const $showDialogButton = $("#settings-button"); | ||||
|     const $dialog = $("#settings-dialog"); | ||||
|     const $tabs = $("#settings-tabs"); | ||||
|  | ||||
| @@ -38,6 +39,8 @@ const settings = (function() { | ||||
|         showMessage("Settings change have been saved."); | ||||
|     } | ||||
|  | ||||
|     $showDialogButton.click(showDialog); | ||||
|  | ||||
|     return { | ||||
|         showDialog, | ||||
|         saveSettings, | ||||
|   | ||||
| @@ -229,6 +229,8 @@ function uploadAttachment() { | ||||
|     $("#attachment-upload").trigger('click'); | ||||
| } | ||||
|  | ||||
| $("#upload-attachment-button").click(uploadAttachment); | ||||
|  | ||||
| $("#attachment-upload").change(async function() { | ||||
|     const formData = new FormData(); | ||||
|     formData.append('upload', this.files[0]); | ||||
|   | ||||
| @@ -22,6 +22,8 @@ const noteEditor = (function() { | ||||
|     const $attachmentOpen = $("#attachment-open"); | ||||
|     const $searchString = $("#search-string"); | ||||
|  | ||||
|     const $executeScriptButton = $("#execute-script-button"); | ||||
|  | ||||
|     let editor = null; | ||||
|     let codeEditor = null; | ||||
|  | ||||
| @@ -373,6 +375,8 @@ const noteEditor = (function() { | ||||
|  | ||||
|     $(document).bind('keydown', "ctrl+return", executeCurrentNote); | ||||
|  | ||||
|     $executeScriptButton.click(executeCurrentNote()); | ||||
|  | ||||
|     setInterval(saveNoteIfChanged, 5000); | ||||
|  | ||||
|     return { | ||||
|   | ||||
| @@ -4,6 +4,9 @@ const noteTree = (function() { | ||||
|     const $tree = $("#tree"); | ||||
|     const $parentList = $("#parent-list"); | ||||
|     const $parentListList = $("#parent-list-inner"); | ||||
|     const $createTopLevelNoteButton = $("#create-top-level-note-button"); | ||||
|     const $collapseTreeButton = $("#collapse-tree-button"); | ||||
|     const $scrollToCurrentNoteButton = $("#scroll-to-current-note-button"); | ||||
|  | ||||
|     let instanceName = null; // should have better place | ||||
|  | ||||
| @@ -945,6 +948,10 @@ const noteTree = (function() { | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     $createTopLevelNoteButton.click(createNewTopLevelNote); | ||||
|     $collapseTreeButton.click(collapseTree); | ||||
|     $scrollToCurrentNoteButton.click(scrollToCurrentNote); | ||||
|  | ||||
|     return { | ||||
|         reload, | ||||
|         collapseTree, | ||||
|   | ||||
| @@ -5,6 +5,8 @@ const protected_session = (function() { | ||||
|     const $passwordForm = $("#protected-session-password-form"); | ||||
|     const $password = $("#protected-session-password"); | ||||
|     const $noteDetailWrapper = $("#note-detail-wrapper"); | ||||
|     const $protectButton = $("#protect-button"); | ||||
|     const $unprotectButton = $("#unprotect-button"); | ||||
|  | ||||
|     let protectedSessionDeferred = null; | ||||
|     let lastProtectedSessionOperationDate = null; | ||||
| @@ -169,6 +171,9 @@ const protected_session = (function() { | ||||
|         } | ||||
|     }, 5000); | ||||
|  | ||||
|     $protectButton.click(protectNoteAndSendToServer); | ||||
|     $unprotectButton.click(unprotectNoteAndSendToServer); | ||||
|  | ||||
|     return { | ||||
|         setProtectedSessionTimeout, | ||||
|         ensureProtectedSession, | ||||
|   | ||||
| @@ -7,6 +7,7 @@ const searchTree = (function() { | ||||
|     const $doSearchButton = $("#do-search-button"); | ||||
|     const $saveSearchButton = $("#save-search-button"); | ||||
|     const $searchBox = $("#search-box"); | ||||
|     const $toggleSearchButton = $("#toggle-search-button"); | ||||
|  | ||||
|     $resetSearchButton.click(resetSearch); | ||||
|  | ||||
| @@ -74,6 +75,8 @@ const searchTree = (function() { | ||||
|         e.preventDefault(); | ||||
|     }); | ||||
|  | ||||
|     $toggleSearchButton.click(toggleSearch); | ||||
|  | ||||
|     return { | ||||
|         toggleSearch | ||||
|     }; | ||||
|   | ||||
| @@ -15,6 +15,8 @@ async function syncNow() { | ||||
|     } | ||||
| } | ||||
|  | ||||
| $("#sync-now-button").click(syncNow); | ||||
|  | ||||
| async function forceNoteSync(noteId) { | ||||
|     const result = await server.post('sync/force-note-sync/' + noteId); | ||||
|  | ||||
|   | ||||
| @@ -14,22 +14,22 @@ | ||||
|         </div> | ||||
|  | ||||
|         <div style="flex-grow: 100;"> | ||||
|           <button class="btn btn-xs" onclick="jumpToNote.showDialog();" title="CTRL+J">Jump to note</button> | ||||
|           <button class="btn btn-xs" onclick="recentNotes.showDialog();" title="CTRL+E">Recent notes</button> | ||||
|           <button class="btn btn-xs" onclick="recentChanges.showDialog();">Recent changes</button> | ||||
|           <button class="btn btn-xs" id="jump-to-note-button" title="CTRL+J">Jump to note</button> | ||||
|           <button class="btn btn-xs" id="recent-notes-button" title="CTRL+E">Recent notes</button> | ||||
|           <button class="btn btn-xs" id="recent-changes-button">Recent changes</button> | ||||
|         </div> | ||||
|  | ||||
|         <div id="plugin-buttons"> | ||||
|         </div> | ||||
|  | ||||
|         <div> | ||||
|           <button class="btn btn-xs" onclick="syncNow();" title="Number of outstanding changes to be pushed to server"> | ||||
|           <button class="btn btn-xs" id="sync-now-button" title="Number of outstanding changes to be pushed to server"> | ||||
|             <span class="ui-icon ui-icon-refresh"></span> | ||||
|  | ||||
|             Sync now (<span id="changes-to-push-count">0</span>) | ||||
|           </button> | ||||
|  | ||||
|           <button class="btn btn-xs" onclick="settings.showDialog();"> | ||||
|           <button class="btn btn-xs" id="settings-button"> | ||||
|             <span class="ui-icon ui-icon-gear"></span> Settings</button> | ||||
|  | ||||
|           <form action="logout" id="logout-button" method="POST" style="display: inline;"> | ||||
| @@ -40,16 +40,16 @@ | ||||
|  | ||||
|       <div class="hide-toggle" style="grid-area: tree-actions;"> | ||||
|         <div style="display: flex; justify-content: space-around; padding: 10px 0 10px 0; margin: 0 20px 0 20px; border: 1px solid #ccc;"> | ||||
|           <a onclick="noteTree.createNewTopLevelNote()" title="Create new top level note" class="icon-action" | ||||
|           <a id="create-top-level-note-button" title="Create new top level note" class="icon-action" | ||||
|              style="background: url('images/icons/file-plus.png')"></a> | ||||
|  | ||||
|           <a onclick="noteTree.collapseTree()" title="Collapse note tree" class="icon-action" | ||||
|           <a id="collapse-tree-button" title="Collapse note tree" class="icon-action" | ||||
|              style="background: url('images/icons/list.png')"></a> | ||||
|  | ||||
|           <a onclick="noteTree.scrollToCurrentNote()" title="Scroll to current note. Shortcut CTRL+." class="icon-action" | ||||
|           <a id="scroll-to-current-note-button" title="Scroll to current note. Shortcut CTRL+." class="icon-action" | ||||
|              style="background: url('images/icons/crosshair.png')"></a> | ||||
|  | ||||
|           <a onclick="searchTree.toggleSearch()" title="Search in notes" class="icon-action" | ||||
|           <a id="toggle-search-button" title="Search in notes" class="icon-action" | ||||
|              style="background: url('images/icons/search.png')"></a> | ||||
|         </div> | ||||
|  | ||||
| @@ -80,14 +80,12 @@ | ||||
|  | ||||
|       <div class="hide-toggle" style="grid-area: title;"> | ||||
|         <div style="display: flex; align-items: center;"> | ||||
|           <a onclick="protected_session.protectNoteAndSendToServer()" | ||||
|              title="Protect the note so that password will be required to view the note" | ||||
|           <a title="Protect the note so that password will be required to view the note" | ||||
|              class="icon-action" | ||||
|              id="protect-button" | ||||
|              style="display: none; background: url('images/icons/lock.png')"></a> | ||||
|  | ||||
|           <a onclick="protected_session.unprotectNoteAndSendToServer()" | ||||
|              title="Unprotect note so that password will not be required to access this note in the future" | ||||
|           <a title="Unprotect note so that password will not be required to access this note in the future" | ||||
|              class="icon-action" | ||||
|              id="unprotect-button" | ||||
|              style="display: none; background: url('images/icons/unlock.png')"></a> | ||||
| @@ -100,8 +98,7 @@ | ||||
|  | ||||
|           <button class="btn btn-sm" | ||||
|                   style="display: none; margin-right: 10px" | ||||
|                   id="execute-script-button" | ||||
|                   onclick="noteEditor.executeCurrentNote()">Execute <kbd>Ctrl+Enter</kbd></button> | ||||
|                   id="execute-script-button">Execute <kbd>Ctrl+Enter</kbd></button> | ||||
|  | ||||
|           <div class="dropdown" id="note-type" data-bind="visible: type() != 'search'"> | ||||
|             <button data-bind="disable: isDisabled()" id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-sm"> | ||||
| @@ -126,10 +123,10 @@ | ||||
|               <span class="caret"></span> | ||||
|             </button> | ||||
|             <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dLabel"> | ||||
|               <li><a onclick="noteHistory.showCurrentNoteHistory();"><kbd>Alt+H</kbd> History</a></li> | ||||
|               <li><a onclick="attributesDialog.showDialog();"><kbd>Alt+A</kbd> Attributes</a></li> | ||||
|               <li><a onclick="noteSource.showDialog();"><kbd>Ctrl+U</kbd> HTML source</a></li> | ||||
|               <li><a onclick="uploadAttachment();">Upload attachment</a></li> | ||||
|               <li><a id="show-history-button"><kbd>Alt+H</kbd> History</a></li> | ||||
|               <li><a class="show-attributes-button"><kbd>Alt+A</kbd> Attributes</a></li> | ||||
|               <li><a id="show-source-button"><kbd>Ctrl+U</kbd> HTML source</a></li> | ||||
|               <li><a id="upload-attachment-button">Upload attachment</a></li> | ||||
|             </ul> | ||||
|           </div> | ||||
|         </div> | ||||
| @@ -208,7 +205,7 @@ | ||||
|       </div> | ||||
|  | ||||
|       <div id="attribute-list"> | ||||
|         <button class="btn btn-sm" onclick="attributesDialog.showDialog();">Attributes:</button> | ||||
|         <button class="btn btn-sm show-attributes-button">Attributes:</button> | ||||
|  | ||||
|         <span id="attribute-list-inner"></span> | ||||
|       </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user