Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 "use strict"; | |
2 | |
3 (function() | |
4 { | |
5 var supportedPlatforms = { | |
6 | |
7 // Desktop browsers | |
8 "chrome": { | |
9 installer: "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaib dccddilifddb", | |
10 label: "Chrome" | |
juliandoucette
2018/04/06 12:35:23
Are these labels still being used?
ire
2018/04/06 13:21:49
Good catch, forgot about that! Removed.
| |
11 }, | |
12 "opera": { | |
13 installer: "https://addons.opera.com/extensions/details/opera-adblock/?dis play=en-US", | |
14 label: "Opera" | |
15 }, | |
16 "yandexbrowser": { | |
17 installer: "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaib dccddilifddb", | |
18 label: "Yandex Browser" | |
19 }, | |
20 "msie": { | |
21 installer: "https://update.adblockplus.org/latest/adblockplusie.exe", | |
22 label: "Internet Explorer" | |
23 }, | |
24 "msedge": { | |
25 installer: "https://www.microsoft.com/store/p/adblock-plus/9nblggh4r9nz", | |
26 label: "Micrsoft Edge" | |
27 }, | |
28 "firefox": { | |
29 installer: "https://update.adblockplus.org/latest/adblockplusfirefox.xpi", | |
30 label: "Firefox" | |
31 }, | |
32 "safari": { | |
33 installer: "https://update.adblockplus.org/latest/adblockplussafari.safari extz", | |
34 label: "Safari" | |
35 }, | |
36 "maxthon": "", | |
37 | |
38 // Mobile platforms | |
39 "ios": { | |
40 installer: "https://eyeo.to/adblockbrowser/ios/abp-website", | |
41 label: "iOS", | |
42 }, | |
43 "android": { | |
44 installer: "https://eyeo.to/adblockbrowser/android/abp-website", | |
45 label: "Android" | |
46 } | |
47 }; | |
48 | |
49 function setupHeroDownloadButton() | |
50 { | |
51 var detectedPlatform = Object.keys(supportedPlatforms).find(hasOwnProperty.b ind(bowser)); | |
juliandoucette
2018/04/06 12:35:23
NIT: Line is too long?
ire
2018/04/06 13:21:49
Done.
| |
52 | |
53 if (!detectedPlatform) return; | |
54 | |
55 document.body.classList.add(detectedPlatform); | |
56 | |
57 if (detectedPlatform === "maxthon") return; | |
juliandoucette
2018/04/06 12:35:23
NIT: Code style says we should use == :(
ire
2018/04/06 13:21:49
I can't seem to find where it says that?
(Done an
juliandoucette
2018/04/06 16:29:16
It's kindof obscure:
ABP Coding style > General >
ire
2018/04/09 09:24:01
Acknowledged.
| |
58 | |
59 var heroDownloadButton = document.getElementById("hero-download-button"); | |
60 heroDownloadButton.href = supportedPlatforms[detectedPlatform].installer; | |
61 heroDownloadButton.innerHTML = document | |
62 .getElementById("hero-download-button-template") | |
63 .innerHTML; | |
64 | |
65 heroDownloadButton.addEventListener("click", function(event) | |
66 { | |
67 if (!chrome) return; | |
juliandoucette
2018/04/06 12:35:23
It's possible for chrome to exist without webstore
ire
2018/04/06 13:21:49
Agreed.
| |
68 event.preventDefault(); | |
69 chrome.webstore.install(); | |
70 }); | |
71 } | |
72 | |
73 if (bowser) setupHeroDownloadButton(); | |
74 | |
75 }()); | |
OLD | NEW |