mirror of
https://github.com/gamaio/lobli.git
synced 2025-01-03 15:52:42 +00:00
371b00f452
This should fix a bug I've been experiencing where the context menu would not exist until I uninstall the extension and install it again from the chrome webstore
21 lines
874 B
JavaScript
21 lines
874 B
JavaScript
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 lob.li", "contexts": ["image", "video", "audio"], "id": "shortenFile"});
|
|
chrome.contextMenus.create({"title": "Shorten link with lob.li", "contexts": ["link"], "id": "shortenLink"});
|
|
});
|
|
|
|
chrome.runtime.onStartup.addListener(function(){
|
|
chrome.contextMenus.create({"title": "Shorten link to this file with lob.li", "contexts": ["image", "video", "audio"], "id": "shortenFile"});
|
|
chrome.contextMenus.create({"title": "Shorten link with lob.li", "contexts": ["link"], "id": "shortenLink"});
|
|
});
|