summaryrefslogtreecommitdiff
path: root/src/lib/UA.js
blob: 57e98aeba31d4636c70f256c00d64f9319e06116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
  let mozWebExtUrl = document.URL.startsWith("moz-");
  let isMozilla = mozWebExtUrl || typeof window.wrappedJSObject === "object";
  let mobile = false;
  if (isMozilla) {
    if (mozWebExtUrl) {
      // help browser-specific UI styling
      document.documentElement.classList.add("mozwebext");
      mobile = !("windows" in browser);
    }
  } else {
    // shims for non-Mozilla browsers
    if (typeof chrome === "object" && !chrome.tabs) {
      // content script shims
    }
  }

  var UA = {
    isMozilla,
    mobile,
  };
}