From a760fbbf1b1f7c56d0edf2af300dd716b9eab5b6 Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 5 Sep 2017 22:01:22 -0400 Subject: [PATCH] note decryption --- src/templates/app.html | 3 ++- static/js/note.js | 16 ++++++++++++++++ static/style.css | 10 ++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/templates/app.html b/src/templates/app.html index 92a0ca30e..e959bf17d 100644 --- a/src/templates/app.html +++ b/src/templates/app.html @@ -40,7 +40,8 @@
- + +
diff --git a/static/js/note.js b/static/js/note.js index c453f3683..8b356c32c 100644 --- a/static/js/note.js +++ b/static/js/note.js @@ -144,9 +144,13 @@ recentNotes = []; function setNoteBackgroundIfEncrypted(note) { if (note.detail.encryption > 0) { $(".note-editable").addClass("encrypted"); + $("#encryptButton").hide(); + $("#decryptButton").show(); } else { $(".note-editable").removeClass("encrypted"); + $("#encryptButton").show(); + $("#decryptButton").hide(); } } @@ -306,6 +310,18 @@ function encryptNoteAndSendToServer() { }); } +function decryptNoteAndSendToServer() { + const note = globalNote; + + updateNoteFromInputs(note); + + note.detail.encryption = 0; + + saveNoteToServer(note); + + setNoteBackgroundIfEncrypted(note); +} + function decryptNoteIfNecessary(note) { let decryptPromise; diff --git a/static/style.css b/static/style.css index f429cf10f..39d4caca0 100644 --- a/static/style.css +++ b/static/style.css @@ -53,4 +53,14 @@ span.fancytree-node.fancytree-folder > span.fancytree-icon { overflow-y: auto; /* prevent horizontal scrollbar */ overflow-x: hidden; +} + +#encryptButton { + position: absolute; + left: 950px; +} + +#decryptButton { + position: absolute; + left: 950px; } \ No newline at end of file