Created
September 22, 2013 16:12
-
-
Save pastak/6661409 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ConnectMessenger.bind('create_context_menu', function(event, data, port) { | |
| chrome.contextMenus.removeAll(); | |
| if(data.type == 'default'){ | |
| chrome.contextMenus.create({ | |
| 'title':'default menu', | |
| 'contexts':["page", "frame", "editable", "image", "video", "audio"], | |
| 'onclick':function(info, tab) { | |
| alert('default'); | |
| } | |
| }); | |
| chrome.contextMenus.create({ | |
| 'title':'select "%s"', | |
| 'contexts':['selection'], | |
| 'onclick': function(info, tab) { | |
| alert('select'); | |
| } | |
| }) | |
| } else { | |
| chrome.contextMenus.create({ | |
| 'title':'link menu', | |
| 'contexts':['link'], | |
| 'onclick':function(info, tab) { | |
| window.open(info.linkUrl); | |
| } | |
| }); | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment