Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: static/js/index.js

Issue 29727563: Fixes #35 - Progressively enhance install button with appropriate links and text (Closed) Base URL: https://hg.adblockplus.org/web.adblockplus.org
Patch Set: Rebase Created March 21, 2018, 9:16 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 "use strict";
2
3 (function()
4 {
5 var supportedPlatforms = {
saroyanm 2018/03/23 19:08:37 I wonder what SEO implications this can introduce,
ire 2018/03/26 10:23:01 This is a good point. As I wasn't part of the init
6 // Desktop browsers
7 "chrome": {
8 installer: "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaib dccddilifddb",
saroyanm 2018/03/23 19:08:37 Seems like here we also don't have inline installa
ire 2018/03/26 10:23:01 Done.
9 label: "Chrome"
10 },
11 "opera": {
12 installer: "https://addons.opera.com/extensions/details/opera-adblock/?dis play=en-US",
13 label: "Opera"
14 },
15 "yandexbrowser": {
16 installer: "https://chrome.google.com/webstore/detail/cfhdojbkjhnklbpkdaib dccddilifddb",
17 label: "Yandex Browser"
18 },
19 "msie": {
20 installer: "https://update.adblockplus.org/latest/adblockplusie.exe",
21 label: "Internet Explorer"
22 },
23 "msedge": {
24 installer: "https://www.microsoft.com/store/p/adblock-plus/9nblggh4r9nz",
25 label: "Micrsoft Edge"
26 },
27 "firefox": {
28 installer: "https://update.adblockplus.org/latest/adblockplusfirefox.xpi",
29 label: "Firefox"
30 },
31 "safari": {
32 installer: "https://update.adblockplus.org/latest/adblockplussafari.safari extz",
33 label: "Safari"
34 },
35 "maxthon": "",
36
37 // Mobile platforms
38 "ios": {
39 installer: "https://eyeo.to/adblockbrowser/ios/abp-website",
saroyanm 2018/03/23 19:08:37 We might want to use this or similar redirection l
ire 2018/03/26 10:23:01 Ack.
40 label: "iOS",
41 },
42 "android": {
43 installer: "https://eyeo.to/adblockbrowser/android/abp-website",
44 label: "Android"
45 }
46 };
47
48 function setupHeroDownloadButton()
49 {
50 var heroDownloadButton = document.getElementById("hero-download-button");
51 var detectedPlatform;
52
53 for (var key in supportedPlatforms) if (bowser[key]) detectedPlatform = key;
54
55 if (!detectedPlatform) return;
56
57 document.body.classList.add(detectedPlatform);
58
59 if (detectedPlatform === "maxthon") return;
60
61 heroDownloadButton.href = supportedPlatforms[detectedPlatform].installer;
62 heroDownloadButton.textContent = document
63 .getElementById("hero-download-button-template")
64 .innerHTML
65 .replace("browser", supportedPlatforms[detectedPlatform].label);
66 }
67
68 if (bowser) setupHeroDownloadButton();
69
70 }());
OLDNEW

Powered by Google App Engine
This is Rietveld