diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.js index a031013d5..f5c489d1a 100644 --- a/public/javascripts/context_menu.js +++ b/public/javascripts/context_menu.js @@ -1,3 +1,5 @@ +"use strict"; + const contextMenu = (function() { const treeEl = $("#tree"); diff --git a/public/javascripts/dialogs/add_link.js b/public/javascripts/dialogs/add_link.js index 848d0369e..0fbe2c469 100644 --- a/public/javascripts/dialogs/add_link.js +++ b/public/javascripts/dialogs/add_link.js @@ -1,3 +1,5 @@ +"use strict"; + const addLink = (function() { const dialogEl = $("#insert-link-dialog"); const formEl = $("#insert-link-form"); diff --git a/public/javascripts/dialogs/event_log.js b/public/javascripts/dialogs/event_log.js index e3b0630ba..1dedf1863 100644 --- a/public/javascripts/dialogs/event_log.js +++ b/public/javascripts/dialogs/event_log.js @@ -1,3 +1,5 @@ +"use strict"; + const eventLog = (function() { const dialogEl = $("#event-log-dialog"); const listEl = $("#event-log-list"); diff --git a/public/javascripts/dialogs/jump_to_note.js b/public/javascripts/dialogs/jump_to_note.js index f324684d5..3cfc84ce0 100644 --- a/public/javascripts/dialogs/jump_to_note.js +++ b/public/javascripts/dialogs/jump_to_note.js @@ -1,3 +1,5 @@ +"use strict"; + const jumpToNote = (function() { const dialogEl = $("#jump-to-note-dialog"); const autoCompleteEl = $("#jump-to-note-autocomplete"); diff --git a/public/javascripts/dialogs/note_history.js b/public/javascripts/dialogs/note_history.js index b5db2fd7d..0f40cd1e7 100644 --- a/public/javascripts/dialogs/note_history.js +++ b/public/javascripts/dialogs/note_history.js @@ -1,3 +1,5 @@ +"use strict"; + const noteHistory = (function() { const dialogEl = $("#note-history-dialog"); const listEl = $("#note-history-list"); diff --git a/public/javascripts/dialogs/recent_changes.js b/public/javascripts/dialogs/recent_changes.js index 2d6c5d475..89fc3d363 100644 --- a/public/javascripts/dialogs/recent_changes.js +++ b/public/javascripts/dialogs/recent_changes.js @@ -1,3 +1,5 @@ +"use strict"; + const recentChanges = (function() { const dialogEl = $("#recent-changes-dialog"); diff --git a/public/javascripts/dialogs/recent_notes.js b/public/javascripts/dialogs/recent_notes.js index 29f247454..b16c83680 100644 --- a/public/javascripts/dialogs/recent_notes.js +++ b/public/javascripts/dialogs/recent_notes.js @@ -1,3 +1,5 @@ +"use strict"; + const recentNotes = (function() { const dialogEl = $("#recent-notes-dialog"); const selectBoxEl = $('#recent-notes-select-box'); diff --git a/public/javascripts/dialogs/settings.js b/public/javascripts/dialogs/settings.js index 1c2160e36..f968e85e4 100644 --- a/public/javascripts/dialogs/settings.js +++ b/public/javascripts/dialogs/settings.js @@ -1,3 +1,5 @@ +"use strict"; + const settings = (function() { const dialogEl = $("#settings-dialog"); const tabsEl = $("#settings-tabs"); diff --git a/public/javascripts/drag_and_drop.js b/public/javascripts/drag_and_drop.js index 76561f564..1b681a1e3 100644 --- a/public/javascripts/drag_and_drop.js +++ b/public/javascripts/drag_and_drop.js @@ -1,3 +1,5 @@ +"use strict"; + const dragAndDropSetup = { autoExpandMS: 600, draggable: { // modify default jQuery draggable options diff --git a/public/javascripts/encryption.js b/public/javascripts/encryption.js index 013cf3a52..ac060dc4a 100644 --- a/public/javascripts/encryption.js +++ b/public/javascripts/encryption.js @@ -1,3 +1,5 @@ +"use strict"; + const encryption = (function() { const dialogEl = $("#encryption-password-dialog"); const encryptionPasswordFormEl = $("#encryption-password-form"); diff --git a/public/javascripts/init.js b/public/javascripts/init.js index 94a22cfbc..93d900e33 100644 --- a/public/javascripts/init.js +++ b/public/javascripts/init.js @@ -1,4 +1,6 @@ -glob = { +"use strict"; + +const glob = { activeDialog: null }; diff --git a/public/javascripts/link.js b/public/javascripts/link.js index cae4a5bcc..38eb148ee 100644 --- a/public/javascripts/link.js +++ b/public/javascripts/link.js @@ -1,3 +1,5 @@ +"use strict"; + const link = (function() { function getNoteIdFromLink(url) { const noteIdMatch = /app#([A-Za-z0-9]{12})/.exec(url); diff --git a/public/javascripts/migration.js b/public/javascripts/migration.js index 9eb12c557..27da71315 100644 --- a/public/javascripts/migration.js +++ b/public/javascripts/migration.js @@ -1,3 +1,5 @@ +"use strict"; + $(document).ready(() => { $.get(baseApiUrl + 'migration').then(result => { const appDbVersion = result.app_db_version; diff --git a/public/javascripts/note_editor.js b/public/javascripts/note_editor.js index f39a26fa1..af71adbbb 100644 --- a/public/javascripts/note_editor.js +++ b/public/javascripts/note_editor.js @@ -1,3 +1,5 @@ +"use strict"; + const noteEditor = (function() { const treeEl = $("#tree"); const noteTitleEl = $("#note-title"); diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index 7f21b4a71..078d96230 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -1,3 +1,5 @@ +"use strict"; + const noteTree = (function() { const noteDetailEl = $('#note-detail'); const treeEl = $("#tree"); @@ -37,10 +39,10 @@ const noteTree = (function() { } function setExpandedToServer(note_id, is_expanded) { - expanded_num = is_expanded ? 1 : 0; + const expandedNum = is_expanded ? 1 : 0; $.ajax({ - url: baseApiUrl + 'notes/' + note_id + '/expanded/' + expanded_num, + url: baseApiUrl + 'notes/' + note_id + '/expanded/' + expandedNum, type: 'PUT', contentType: "application/json", success: result => {} diff --git a/public/javascripts/status.js b/public/javascripts/status.js index bbf32d548..31f80597a 100644 --- a/public/javascripts/status.js +++ b/public/javascripts/status.js @@ -1,3 +1,5 @@ +"use strict"; + const status = (function() { const treeEl = $("#tree"); const $changesToPushCountEl = $("#changesToPushCount"); diff --git a/public/javascripts/sync.js b/public/javascripts/sync.js index 76ecfe93f..50729c703 100644 --- a/public/javascripts/sync.js +++ b/public/javascripts/sync.js @@ -1,3 +1,5 @@ +"use strict"; + function syncNow() { $.ajax({ url: baseApiUrl + 'sync/now', diff --git a/public/javascripts/tree_mutations.js b/public/javascripts/tree_mutations.js index ca667e380..ea6dc2468 100644 --- a/public/javascripts/tree_mutations.js +++ b/public/javascripts/tree_mutations.js @@ -1,3 +1,5 @@ +"use strict"; + function moveBeforeNode(node, beforeNode) { $.ajax({ url: baseApiUrl + 'notes/' + node.key + '/moveBefore/' + beforeNode.key, diff --git a/public/javascripts/tree_utils.js b/public/javascripts/tree_utils.js index 69d0d27f9..66b15bac9 100644 --- a/public/javascripts/tree_utils.js +++ b/public/javascripts/tree_utils.js @@ -1,3 +1,5 @@ +"use strict"; + const treeEl = $("#tree"); function getParentKey(node) { diff --git a/public/javascripts/utils.js b/public/javascripts/utils.js index ed96f2976..b44f8ef9e 100644 --- a/public/javascripts/utils.js +++ b/public/javascripts/utils.js @@ -1,3 +1,5 @@ +"use strict"; + function message(str) { const top = $("#top-message");