mirror of
https://github.com/c0de-archive/Fox.ci_Chrome_Extension.git
synced 2024-12-22 13:42:39 +00:00
Add js/contextmenu.js
This javascript file uses chrome's API to add one or two context menu entries. Most of the time, the shortenFile will not be called, but it is available Signed-off-by: David Todd <c0de@unps.us>
This commit is contained in:
parent
1e1f4104b7
commit
01d2275d91
15
Fox.ci_Chrome_Extension/src/js/contextmenu.js
Executable file
15
Fox.ci_Chrome_Extension/src/js/contextmenu.js
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
chrome.contextMenus.onClicked.addListener(function(info, tab) {
|
||||||
|
switch(info.menuItemId) {
|
||||||
|
case "shortenLink":
|
||||||
|
shortenURL(info.linkUrl, tab.id);
|
||||||
|
break;
|
||||||
|
case "shortenFile":
|
||||||
|
shortenURL(info.srcUrl, tab.id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chrome.runtime.onInstalled.addListener(function() {
|
||||||
|
chrome.contextMenus.create({"title": "Shorten link to this file with fox.ci", "contexts": ["image", "video", "audio"], "id": "shortenFile"});
|
||||||
|
chrome.contextMenus.create({"title": "Shorten link with fox.ci", "contexts": ["link"], "id": "shortenLink"});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user