tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

background.js (966B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 /* eslint-env webextensions */
      6 
      7 /* Avoid adding ID selector rules in this style sheet, since they could
      8 * inadvertently match elements in the article content. */
      9 
     10 // Counts to three and sends a greeting via the browser action of a newly created tab.
     11 browser.tabs.onCreated.addListener(tab => {
     12  let counter = 0;
     13  let intervalId = setInterval(() => {
     14    var message;
     15    if (++counter <= 3) {
     16      message = "" + counter;
     17    } else {
     18      message = "Hi!";
     19      clearInterval(intervalId);
     20    }
     21    browser.browserAction.setBadgeTextColor({
     22      tabId: tab.id,
     23      color: "#FFFFFF",
     24    });
     25    browser.browserAction.setBadgeText({ tabId: tab.id, text: message });
     26  }, 1000);
     27 });
     28 
     29 browser.browserAction.setBadgeBackgroundColor({ color: "#AAAAAA" });