summaryrefslogtreecommitdiff
path: root/chrome/content/accountWizard/bitmaskMessengerOverlay.js
blob: 148290c3fc99a3525a985bdecce7563743b5cfac (plain)
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
window.addEventListener("load", function() {
  overlayStartup();
}, false);

window.setInterval(function() {
  overlayStartup();
}, 3000);

function overlayStartup() {
  let myPanel = document.getElementById("bitmaskStatusBarPanel");
  let strBundle = document.getElementById("bitmaskMessengerStrings");

  // We just need to check if bitmaskd is running and if we were able to
  // authorize with it using the token from bitmask.js
  let promise = bitmask.core.status();
  promise.then(function(data) {
    myPanel.label = strBundle.getFormattedString("bitmaskStatusOn", [ data["mail"] ]);
    myPanel.style.color = "green";
    myPanel.src = "chrome://bitmask/skin/on.png";
  }, function(error) {
    myPanel.label = strBundle.getString("bitmaskStatusOff");
    myPanel.style.color = "red";
    myPanel.src = "chrome://bitmask/skin/off.png";
    console.log(error);
  });
}