summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-10-10 21:04:24 +0800
committerWu Cheng-Han2016-10-10 21:04:24 +0800
commit12d5ed43a7376e0ca361160698f07066218d6ed2 (patch)
tree697572ef13990565e5a44a66615540a40ef5def7 /public/js
parent68457ed3a26012e9e72e7ca95bfd7b9c101cdd8b (diff)
Update to support delete note
Diffstat (limited to '')
-rw-r--r--public/js/index.js15
1 files changed, 14 insertions, 1 deletions
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 () {