Skip to content

Instantly share code, notes, and snippets.

@mitchmoser
Created December 25, 2018 08:57
Show Gist options
  • Save mitchmoser/2ad580305d3b9abc32361dea720f6f15 to your computer and use it in GitHub Desktop.
Save mitchmoser/2ad580305d3b9abc32361dea720f6f15 to your computer and use it in GitHub Desktop.
// create empty url variable
var url = ""
/*
* The click event listener:
* where we perform the approprate action
* given the ID of the menu item that was clicked
*/
browser.contextMenus.onClicked.addListener((info, tab) => {
// copy the selection to clipboard
navigator.clipboard.writeText(info.selectionText);
switch (info.menuItemId) {
case "Alien IP":
url = "https://otx.alienvault.com/indicator/ip/"+info.selectionText;
break;
}
browser.tabs.create({url: url});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment