From 12d5ed43a7376e0ca361160698f07066218d6ed2 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 10 Oct 2016 21:04:24 +0800 Subject: Update to support delete note --- public/js/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'public/js') diff --git a/public/js/index.js b/public/js/index.js index b139ad2a..63d7f3db 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -740,7 +740,8 @@ var ui = { editable: $(".ui-permission-editable"), locked: $(".ui-permission-locked"), private: $(".ui-permission-private") - } + }, + delete: $(".ui-delete-note") }, toc: { toc: $('.ui-toc'), @@ -2115,6 +2116,13 @@ ui.infobar.permission.locked.click(function () { ui.infobar.permission.private.click(function () { emitPermission("private"); }); +// delete note +ui.infobar.delete.click(function () { + $('.delete-modal').modal('show'); +}); +$('.ui-delete-modal-confirm').click(function () { + socket.emit('delete'); +}); function emitPermission(_permission) { if (_permission != permission) { @@ -2216,6 +2224,11 @@ socket.on('error', function (data) { if (data.message && data.message.indexOf('AUTH failed') === 0) location.href = serverurl + "/403"; }); +socket.on('delete', function () { + deleteServerHistory(noteid, function (err, data) { + if (!err) location.href = serverurl; + }); +}); var retryOnDisconnect = false; var retryTimer = null; socket.on('maintenance', function () { -- cgit v1.2.3