From 1f466300f66157daf450043e21c6d62f7d59b68e Mon Sep 17 00:00:00 2001 From: stickz Date: Wed, 29 Mar 2023 10:26:56 -0400 Subject: [PATCH] Merge pull request #2397 from TrimmingFool/add-tacklabels-icon-upload Add tracklabels icon upload --- plugins/tracklabels/init.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/plugins/tracklabels/init.js b/plugins/tracklabels/init.js index 529f21614..bbca844dd 100644 --- a/plugins/tracklabels/init.js +++ b/plugins/tracklabels/init.js @@ -77,12 +77,25 @@ if(!$type(theWebUI.getTrackerName)) plugin.contextMenuEntries = theWebUI.contextMenuEntries; theWebUI.contextMenuEntries = function(labelType, el) { - if (labelType === 'ptrackers_cont') { - return plugin.canChangeMenu() ? [] : false; + const entries = plugin.contextMenuEntries.call(theWebUI, labelType, el); + if (plugin.canChangeMenu() && ['ptrackers_cont', 'plabel_cont'].includes(labelType)) { + const lbl = 'ptrackers_cont' === labelType ? el.id.substr(1) : theWebUI.idToLbl(el.id); + if (lbl) + return entries.concat([ + [theUILang.EditIcon, `theWebUI.showTracklabelsDialog('${lbl}');`] + ]); } - return plugin.contextMenuEntries.call(theWebUI, labelType, el); + return entries; } + +theWebUI.showTracklabelsDialog = function(lbl) { + $(`#${plugin.dialogId} input[type=text]`).val(lbl); + theDialogManager.show(plugin.dialogId); +} + + + plugin.updateLabel = theWebUI.updateLabel; theWebUI.updateLabel = function(label, ...args) {