summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtoscer <[email protected]>2017-11-30 13:20:09 +0100
committerwtoscer <[email protected]>2017-11-30 13:20:09 +0100
commit83d5054d3e0cb475856729b33750a44d581dcc6d (patch)
treeecb28f2c61c893f211d4904e763043d0805dbe09
parent79e00725d3825b2f37b553757d73209247e117e7 (diff)
use browser instead of chrome
-rw-r--r--js/background.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/js/background.js b/js/background.js
index dec4290..d64fa82 100644
--- a/js/background.js
+++ b/js/background.js
@@ -108,10 +108,10 @@ function update() {
if (!show_badge) badge.text = '';
- chrome.browserAction.setBadgeBackgroundColor(badge_color);
- chrome.browserAction.setBadgeText(badge);
- chrome.browserAction.setTitle(title);
- chrome.browserAction.setIcon(icon);
+ browser.browserAction.setBadgeBackgroundColor(badge_color);
+ browser.browserAction.setBadgeText(badge);
+ browser.browserAction.setTitle(title);
+ browser.browserAction.setIcon(icon);
}
};
}
@@ -168,18 +168,18 @@ function is_site_url(url) {
}
function init() {
- chrome.browserAction.onClicked.addListener(function() {
+ browser.browserAction.onClicked.addListener(function() {
var site_url = localStorage['site_url'];
if (site_url) {
// try to find already opened tab
- chrome.tabs.query({currentWindow: true}, function(tabs) {
+ browser.tabs.query({currentWindow: true}, function(tabs) {
var found_existing = false;
for (var i = 0, tab; tab = tabs[i]; i++) {
if (tab.url && is_site_url(tab.url)) {
- chrome.tabs.update(tab.id, {highlighted: true});
+ browser.tabs.update(tab.id, {highlighted: true});
update();
found_existing = true;
return;
@@ -188,11 +188,11 @@ function init() {
// check if current tab is newtab (only if not updated yet)
if (!found_existing) {
- chrome.tabs.query({currentWindow: true, active: true}, function(tabs) {
+ browser.tabs.query({currentWindow: true, active: true}, function(tabs) {
if (tabs[0].url && is_newtab(tabs[0].url)) {
- chrome.tabs.update(tabs[0].id, {url: site_url});
+ browser.tabs.update(tabs[0].id, {url: site_url});
} else {
- chrome.tabs.create({url: site_url});
+ browser.tabs.create({url: site_url});
}
});
} // (if (!found_existing))
@@ -206,8 +206,8 @@ function init() {
// `feeds_update_interval` and updates the `alarm` object when extension
// preferences are saved.
timeout();
- chrome.alarms.create({periodInMinutes: 1});
- chrome.alarms.onAlarm.addListener(function() {timeout();});
+ browser.alarms.create({periodInMinutes: 1});
+ browser.alarms.onAlarm.addListener(function() {timeout();});
}
init();