LEFT | RIGHT |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 (function() | 3 (function() |
4 { | 4 { |
5 var supportedPlatforms = { | 5 var supportedPlatforms = { |
6 | 6 |
7 // Desktop browsers | 7 // Desktop browsers |
8 "chrome": "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaibdcc
ddilifddb", | 8 "chrome": "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaibdcc
ddilifddb", |
9 "opera": "https://addons.opera.com/extensions/details/opera-adblock/?display
=en-US", | 9 "opera": "https://addons.opera.com/extensions/details/opera-adblock/?display
=en-US", |
10 "yandexbrowser": "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpk
daibdccddilifddb", | 10 "yandexbrowser": "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpk
daibdccddilifddb", |
(...skipping 14 matching lines...) Expand all Loading... |
25 .find(bowser.hasOwnProperty.bind(bowser)); | 25 .find(bowser.hasOwnProperty.bind(bowser)); |
26 | 26 |
27 if (!detectedPlatform) return; | 27 if (!detectedPlatform) return; |
28 | 28 |
29 document.body.classList.add(detectedPlatform); | 29 document.body.classList.add(detectedPlatform); |
30 | 30 |
31 if (detectedPlatform == "maxthon") return; | 31 if (detectedPlatform == "maxthon") return; |
32 | 32 |
33 var heroDownloadButton = document.getElementById("hero-download-button"); | 33 var heroDownloadButton = document.getElementById("hero-download-button"); |
34 heroDownloadButton.href = supportedPlatforms[detectedPlatform]; | 34 heroDownloadButton.href = supportedPlatforms[detectedPlatform]; |
35 var translatedPlatformName = document | 35 heroDownloadButton.textContent = document |
36 .getElementById(detectedPlatform + "-name-translated") | 36 .getElementById("download-label-" + detectedPlatform) |
37 .textContent; | 37 .textContent; |
38 heroDownloadButton.innerHTML = document | |
39 .getElementById("hero-download-button-template") | |
40 .innerHTML | |
41 .replace("browser", translatedPlatformName); | |
42 | 38 |
43 heroDownloadButton.addEventListener("click", function(event) | 39 heroDownloadButton.addEventListener("click", function(event) |
44 { | 40 { |
45 if (typeof chrome == "undefined") return; | 41 if (typeof chrome == "undefined") return; |
46 event.preventDefault(); | 42 event.preventDefault(); |
47 | 43 |
48 try | 44 try |
49 { | 45 { |
50 chrome.webstore.install(); | 46 chrome.webstore.install(); |
51 } | 47 } |
52 catch(error) | 48 catch(error) |
53 { | 49 { |
54 window.location = "/" + this.hreflang + "/download"; | 50 window.location = "/" + this.hreflang + "/download"; |
55 } | 51 } |
56 }); | 52 }); |
57 } | 53 } |
58 | 54 |
59 if (typeof bowser != "undefined") setupHeroDownloadButton(); | 55 if (typeof bowser != "undefined") setupHeroDownloadButton(); |
60 | 56 |
61 }()); | 57 }()); |
LEFT | RIGHT |