-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbackground.js
33 lines (27 loc) · 1.13 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
// edtsoi
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [new chrome.declarativeContent.PageStateMatcher({})],
actions: [new chrome.declarativeContent.ShowPageAction()]
}]);
});
chrome.tabs.query({}, function(tabs){
chrome.browserAction.setBadgeBackgroundColor({ color: "#6698FF" });
chrome.browserAction.setBadgeText({text: tabs.length.toString()});
});
function updateBadge(){
chrome.tabs.query({}, function(tabs){
chrome.browserAction.setBadgeText({text: tabs.length.toString()});
});
}
// Update number of tabs currently opened.
chrome.tabs.onUpdated.addListener(updateBadge.bind());
chrome.tabs.onRemoved.addListener(updateBadge.bind());
chrome.tabs.onCreated.addListener(updateBadge.bind());
//chrome.commands.onCommand.addListener(function(command) {
// chrome.tabs.query({currentWindow: true}, function(tabs) {
// if (command === 'open-search'){ // open search
// window.open("popup.html");
// }
// });
//});