Created
September 22, 2013 16:12
-
-
Save pastak/6661411 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
document.addEventListener('contextmenu', function (e) { | |
var port = chrome.extension.connect(); | |
var type = 'default'; | |
if (e.target.tagName == 'A'){ | |
type = 'link'; | |
} | |
var url = e.target.href || ''; | |
port.postMessage({ | |
message : 'create_context_menu', | |
data:{ | |
type : type, | |
url : url | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment