summaryrefslogtreecommitdiff
path: root/pages/assets/js/download.js
blob: 9fd0d52ba2a6cb0b81eb1d2b4ea1be0be091215a (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$(document).ready(function() {
  var platform = platformStr();

  $(".download").click(function(e) {
    e.preventDefault();
    download(platform);
  });

  if (["GNU/Linux", "macOS", "Android"].indexOf(platform) != -1) {
    $(".download-text").text("Download Bitmask for " + platform);
  }
});


function download(platform) {
  var link = "install";
  switch (platform) {
    case "GNU/Linux":
      link = "https://dl.bitmask.net/client/linux/stable/Bitmask-linux64-latest.tar.gz";
      break;
    case "macOS":
      link = "https://dl.bitmask.net/client/osx/stable/Bitmask-OSX-latest.pkg";
      break;
    case "Android":
      link = "install/android";
      break;
  }
  window.location = link;
};

function platformStr() {
  if (navigator.platform.indexOf("Linux") != -1) {
    return "GNU/Linux";
  }
  if (navigator.platform.indexOf("Mac") != -1) {
    return "macOS";
  }
  if (navigator.platform.indexOf("Android") != -1) {
    return "Android";
  }
  if (navigator.platform.indexOf("Win") != -1) {
    return "Windows";
  }
  return "Other";
}