| Left: | ||
| Right: |
| 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://addons.opera.com/extensions/details/opera-adblock/?display =en-US", | |
| 10 "yandexbrowser": "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpk daibdccddilifddb", | |
| 11 "msie": "https://update.adblockplus.org/latest/adblockplusie.exe", | |
| 12 "msedge": "https://www.microsoft.com/store/p/adblock-plus/9nblggh4r9nz", | |
| 13 "firefox": "https://update.adblockplus.org/latest/adblockplusfirefox.xpi", | |
| 14 "safari": "https://update.adblockplus.org/latest/adblockplussafari.safariext z", | |
| 15 "maxthon": "", | |
| 16 | |
| 17 // Mobile platforms | |
| 18 "ios": "https://eyeo.to/adblockbrowser/ios/abp-website", | |
| 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)) | |
|
juliandoucette
2018/04/09 13:01:02
NIT: You removed the semicolon.
ire
2018/04/12 08:05:47
Done.
| |
| 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 var translatedPlatformName = document | |
| 36 .getElementById(detectedPlatform + "-name-translated") | |
| 37 .textContent; | |
| 38 heroDownloadButton.innerHTML = document | |
| 39 .getElementById("hero-download-button-template") | |
| 40 .innerHTML | |
| 41 .replace("browser", translatedPlatformName); | |
| 42 | |
| 43 heroDownloadButton.addEventListener("click", function(event) | |
| 44 { | |
| 45 if (typeof chrome == "undefined") return; | |
| 46 event.preventDefault(); | |
| 47 | |
| 48 try | |
| 49 { | |
| 50 chrome.webstore.install(); | |
| 51 } | |
| 52 catch(error) | |
| 53 { | |
| 54 window.location = "/" + this.hreflang + "/download"; | |
| 55 } | |
| 56 }); | |
| 57 } | |
| 58 | |
| 59 if (typeof bowser != "undefined") setupHeroDownloadButton(); | |
| 60 | |
| 61 }()); | |
| OLD | NEW |