Hide edit context menu entry on <2 servers

This commit is contained in:
Corbin Davenport 2023-02-24 12:41:21 -05:00
parent 7ee4429230
commit 88032c4e4e
1 changed files with 13 additions and 11 deletions

View File

@ -91,17 +91,19 @@ async function createContextMenu() {
contexts: ['selection', 'link', 'page']
})
}
// Add seperator and link to settings
chrome.contextMenus.create({
id: 'none',
type: 'separator',
contexts: ['selection', 'link', 'page']
})
chrome.contextMenus.create({
id: 'edit-servers',
title: 'Edit server list',
contexts: ['selection', 'link', 'page']
})
// Add seperator and link to settings, but only if there's more than one server saved
if (data.serverList.length > 1) {
chrome.contextMenus.create({
id: 'none',
type: 'separator',
contexts: ['selection', 'link', 'page']
})
chrome.contextMenus.create({
id: 'edit-servers',
title: 'Edit server list...',
contexts: ['selection', 'link', 'page']
})
}
}
}