all JS functions are now inside old-school JS modules, preparation for ES6 modularization

This commit is contained in:
azivner 2018-03-24 23:58:58 -04:00
parent 001a5107dd
commit b96a1274c5
4 changed files with 261 additions and 245 deletions

View File

@ -151,16 +151,16 @@ const contextMenu = (function() {
treeChanges.deleteNodes(treeService.getSelectedNodes(true));
}
else if (ui.cmd === "exportSubTree") {
exportSubTree(node.data.noteId);
exportService.exportSubTree(node.data.noteId);
}
else if (ui.cmd === "importSubTree") {
importSubTree(node.data.noteId);
exportService.importSubTree(node.data.noteId);
}
else if (ui.cmd === "collapseSubTree") {
treeService.collapseTree(node);
}
else if (ui.cmd === "forceNoteSync") {
forceNoteSync(node.data.noteId);
syncService.forceNoteSync(node.data.noteId);
}
else if (ui.cmd === "sortAlphabetically") {
treeService.sortAlphabetically(node.data.noteId);

View File

@ -1,5 +1,6 @@
"use strict";
const exportService = (function () {
function exportSubTree(noteId) {
const url = utils.getHost() + "/api/export/" + noteId + "?protectedSessionId="
+ encodeURIComponent(protected_session.getProtectedSessionId());
@ -30,3 +31,9 @@ $("#import-upload").change(async function() {
await treeService.reload();
});
return {
exportSubTree,
importSubTree
};
})();

View File

@ -1,5 +1,6 @@
"use strict";
const initService = (function() {
// hot keys are active also inside inputs and content editables
jQuery.hotkeys.options.filterInputAcceptingElements = false;
jQuery.hotkeys.options.filterContentEditable = false;
@ -248,3 +249,4 @@ $("#attachment-upload").change(async function() {
await treeService.activateNode(resp.noteId);
});
})();

View File

@ -1,5 +1,6 @@
"use strict";
const syncService = (function() {
async function syncNow() {
const result = await server.post('sync/now');
@ -22,3 +23,9 @@ async function forceNoteSync(noteId) {
utils.showMessage("Note added to sync queue.");
}
return {
syncNow,
forceNoteSync
};
})();