OLD | NEW |
(Empty) | |
| 1 "use strict"; |
| 2 |
| 3 (function() |
| 4 { |
| 5 var supportedPlatforms = { |
| 6 |
| 7 // Desktop browsers |
| 8 "chrome": "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaibdcc
ddilifddb", |
| 9 "opera": "https://eyeo.to/adblockplus/opera_install/polish-lp", |
| 10 "yandexbrowser": "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpk
daibdccddilifddb", |
| 11 "msie": "https://eyeo.to/adblockplus/ie_install/polish-lp", |
| 12 "msedge": "https://eyeo.to/adblockplus/edge_install/polish-lp", |
| 13 "firefox": "https://eyeo.to/adblockplus/firefox_install/polish-lp", |
| 14 "safari": "https://eyeo.to/adblockplus/safari_install/polish-lp", |
| 15 "maxthon": "", |
| 16 |
| 17 // Mobile platforms |
| 18 "ios": "https://eyeo.to/adblockplus/ios_install/polish-lp", |
| 19 "android": "https://eyeo.to/adblockbrowser/android/abp-website" |
| 20 }; |
| 21 |
| 22 function setupHeroDownloadButton() |
| 23 { |
| 24 var detectedPlatform = Object.keys(supportedPlatforms) |
| 25 .find(bowser.hasOwnProperty.bind(bowser)); |
| 26 |
| 27 if (!detectedPlatform) return; |
| 28 |
| 29 document.body.classList.add(detectedPlatform); |
| 30 |
| 31 if (detectedPlatform == "maxthon") return; |
| 32 |
| 33 var heroDownloadButton = document.getElementById("hero-download-button"); |
| 34 heroDownloadButton.href = supportedPlatforms[detectedPlatform]; |
| 35 heroDownloadButton.textContent = document |
| 36 .getElementById("download-label-" + detectedPlatform) |
| 37 .textContent; |
| 38 |
| 39 heroDownloadButton.addEventListener("click", function(event) |
| 40 { |
| 41 if (typeof chrome == "undefined") return; |
| 42 event.preventDefault(); |
| 43 |
| 44 try |
| 45 { |
| 46 chrome.webstore.install(); |
| 47 } |
| 48 catch(error) |
| 49 { |
| 50 window.location = "/" + this.hreflang + "/download"; |
| 51 } |
| 52 }); |
| 53 } |
| 54 |
| 55 if (typeof bowser != "undefined") setupHeroDownloadButton(); |
| 56 |
| 57 }()); |
OLD | NEW |