summaryrefslogtreecommitdiff
path: root/pages/assets/js/download.js
blob: 38723da77fbafe4b030ff7af92a5bde70ee2bcd8 (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
$(document).ready(function() {
  var platform = platformStr();

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

  if (["linux", "mac", "android"].indexOf(platform) != -1) {
    $(".download-text").text("Download Bitmask for " + platform);
  }
});

function download(platform) {
  var link = "install";
  switch (platform) {
    case "linux":
      link = "https://dl.bitmask.net/client/linux/stable/Bitmask-linux64-latest.tar.gz";
      break;
    case "mac":
      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 "linux";
  }
  if (navigator.platform.indexOf("Mac") != -1) {
    return "mac";
  }
  if (navigator.platform.indexOf("Android") != -1) {
    return "android";
  }
  if (navigator.platform.indexOf("Win") != -1) {
    return "win";
  }
  return "other";
}