From 19150649d6ee5fcf9e2878cc47f61b9c1a78ac00 Mon Sep 17 00:00:00 2001 From: Jiiks Date: Wed, 6 Apr 2016 02:46:22 +0300 Subject: [PATCH] Double click edit plugin --- Plugins/dblClickEdit.plugin.js | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Plugins/dblClickEdit.plugin.js diff --git a/Plugins/dblClickEdit.plugin.js b/Plugins/dblClickEdit.plugin.js new file mode 100644 index 0000000..d9747ba --- /dev/null +++ b/Plugins/dblClickEdit.plugin.js @@ -0,0 +1,49 @@ +//META{"name":"dblClickEdit"}*// + +var dblClickEdit = function () {}; + +dblClickEdit.prototype.onMessage = function () { +}; +dblClickEdit.prototype.onSwitch = function () { +}; +dblClickEdit.prototype.start = function () { + $(document).on("dblclick.dce", function(e) { + var target = $(e.target); + if(target.parents(".message").length > 0) { + var msg = target.parents(".message").first(); + var opt = msg.find(".btn-option"); + opt.click(); + + var popout = $(".option-popout"); + if(popout.children().length == 2) { + popout.children().first().click(); + } else { + popout.hide(); + } + } + }); +}; + +dblClickEdit.prototype.load = function () {}; +dblClickEdit.prototype.unload = function () { + $(document).off("dblclick.dce"); +}; +dblClickEdit.prototype.stop = function () { + $(document).off("dblclick.dce"); +}; +dblClickEdit.prototype.getSettingsPanel = function () { + return ""; +}; + +dblClickEdit.prototype.getName = function () { + return "Double click edit"; +}; +dblClickEdit.prototype.getDescription = function () { + return "Double click messages to edit them"; +}; +dblClickEdit.prototype.getVersion = function () { + return "0.1.0"; +}; +dblClickEdit.prototype.getAuthor = function () { + return "Jiiks"; +}; \ No newline at end of file