-
Notifications
You must be signed in to change notification settings - Fork 12
/
background.js
40 lines (35 loc) · 1.23 KB
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
chrome.tabs.onCreated.addListener(function(tab) {
chrome.tabs.update(tab.id, {autoDiscardable: false});
});
chrome.tabs.onReplaced.addListener(function(tabId) {
chrome.tabs.update(tabId, {autoDiscardable: false});
});
chrome.runtime.onInstalled.addListener(function(details) {
chrome.tabs.query({}, function(tabs) {
tabs.forEach(function(tab) {
chrome.tabs.update(tab.id, {autoDiscardable: false});
});
});
});
chrome.runtime.setUninstallURL("https://chrome.google.com/webstore/detail/dnhngfnfolbmhgealdpolmhimnoliiok/support");
chrome.contextMenus.removeAll();
chrome.contextMenus.create({
id: "review",
title: "🌟 " + chrome.i18n.getMessage("cm_review"),
contexts: ["browser_action"]
});
chrome.contextMenus.create({
id: "support",
title: "💬 " + chrome.i18n.getMessage("cm_support"),
contexts: ["browser_action"]
});
chrome.contextMenus.onClicked.addListener(function(info, tab) {
switch(info.menuItemId) {
case "review":
chrome.tabs.create({url: "https://chrome.google.com/webstore/detail/dnhngfnfolbmhgealdpolmhimnoliiok/reviews"});
break;
case "support":
chrome.tabs.create({url: "https://chrome.google.com/webstore/detail/dnhngfnfolbmhgealdpolmhimnoliiok/support"});
break;
}
});