Skip to content

Commit 851b3e9

Browse files
authored
Merge pull request #2487 from Novik/webui-fix
Merge pull request #2397 from TrimmingFool/add-tacklabels-icon-upload
2 parents a3dc4fb + 1f46630 commit 851b3e9

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

plugins/tracklabels/init.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,25 @@ if(!$type(theWebUI.getTrackerName))
7777

7878
plugin.contextMenuEntries = theWebUI.contextMenuEntries;
7979
theWebUI.contextMenuEntries = function(labelType, el) {
80-
if (labelType === 'ptrackers_cont') {
81-
return plugin.canChangeMenu() ? [] : false;
80+
const entries = plugin.contextMenuEntries.call(theWebUI, labelType, el);
81+
if (plugin.canChangeMenu() && ['ptrackers_cont', 'plabel_cont'].includes(labelType)) {
82+
const lbl = 'ptrackers_cont' === labelType ? el.id.substr(1) : theWebUI.idToLbl(el.id);
83+
if (lbl)
84+
return entries.concat([
85+
[theUILang.EditIcon, `theWebUI.showTracklabelsDialog('${lbl}');`]
86+
]);
8287
}
83-
return plugin.contextMenuEntries.call(theWebUI, labelType, el);
88+
return entries;
8489
}
8590

91+
92+
theWebUI.showTracklabelsDialog = function(lbl) {
93+
$(`#${plugin.dialogId} input[type=text]`).val(lbl);
94+
theDialogManager.show(plugin.dialogId);
95+
}
96+
97+
98+
8699
plugin.updateLabel = theWebUI.updateLabel;
87100
theWebUI.updateLabel = function(label, ...args)
88101
{

0 commit comments

Comments
 (0)