From 9f06d02e5207b47980fd65a8ee4a27133a37dd60 Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 22 Dec 2018 23:37:06 +0100 Subject: [PATCH] double click for actions on sidebar --- js/FeedTree.js | 1 + js/tt-rss.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/js/FeedTree.js b/js/FeedTree.js index aff481e2..14c076a5 100755 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -141,6 +141,7 @@ require(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"] }})); if (bare_id > 0) { + menu.setAttribute('default_item', 1) menu.addChild(new dijit.MenuItem({ label: __("Edit feed"), onClick: function() { diff --git a/js/tt-rss.js b/js/tt-rss.js index 284df974..78520a16 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -78,6 +78,25 @@ function updateFeedList() { persist: true, id: "feedTree", }, "feedTree"); + tree.on('dblclick', function(_, item, evt) { + var tnode = dijit.byNode(item.domNode) + if(tnode._menu === undefined || tnode._menu.attr('default_item') === undefined) { + var element = tnode.domNode + var newevt = new MouseEvent('contextmenu', { + 'view': window, + 'bubbles': true, + 'cancelable': true, + 'screenX': evt.screenX, + 'screenY': evt.screenY, + 'clientX': evt.clientX, + 'clientY': evt.clientY, + }); + return !element.dispatchEvent(newevt); + } else { + var mi = tnode._menu.getChildren()[tnode._menu.attr('default_item')] + mi.onClick(evt) + } + }) /* var menu = new dijit.Menu({id: 'feedMenu'});