Skip to content

Commit

Permalink
Hide edit context menu entry on <2 servers
Browse files Browse the repository at this point in the history
  • Loading branch information
corbindavenport committed Feb 24, 2023
1 parent 7ee4429 commit 88032c4
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
})
}
}
}

Expand Down

0 comments on commit 88032c4

Please sign in to comment.