Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 {% block head %} | 1 <head> |
2 <style> | |
3 /* Hide TOS & Install on android page when not using Samsung Browser */ | |
4 .android:not(.ua-samsung) #terms-message, | |
5 .android:not(.ua-samsung) #install, | |
6 /* Hide other platforms on android page when using Android */ | |
7 .ua-andriod.android #other-platform, | |
ire
2018/05/02 08:06:59
Typo in "ua-android"
| |
8 /* Hide ABB banner on android page when using Samsung Browser */ | |
9 #content.ua-android.ua-samsung #abb-banner | |
10 { | |
11 display: none; | |
12 } | |
13 | |
14 /* Show ABB notification under install button when using Samsung Browser */ | |
15 #content.ua-android.ua-samsung #adblock-browser-notification | |
16 { | |
17 display: block; | |
18 } | |
19 </style> | |
2 <script src="/js/vendor/bowser.js"></script> | 20 <script src="/js/vendor/bowser.js"></script> |
3 <script> | 21 <script> |
4 if (bowser instanceof Object && bowser.samsungBrowser) | 22 document.addEventListener("DOMContentLoaded", function() |
5 { | 23 { |
6 // hide the Adblock Browser banner | 24 if (!bowser instanceof Object) return; |
7 document | |
8 .getElementById("content") | |
9 .classList.remove("ua-android"); | |
10 | 25 |
11 // change the Android install link to Samsung Browser | 26 var locale = "{{ locale }}"; |
12 document | 27 |
13 .getElementById("install-android") | 28 var contentElement = document.getElementById("content"); |
ire
2018/05/02 08:06:59
Coding style -> "No hungarian notation"
| |
14 .href = "https://play.google.com/store/apps/details?id=org.adblockplus.a dblockplussbrowser"; | 29 |
15 } | 30 // Replicating server behaviour on the frontend for testing |
16 else | 31 if (bowser.android) |
17 { | 32 contentElement.classList.add("ua-android"); |
18 // hide TOS message and install button for not-samsung android browsers | 33 |
19 document.getElementById("terms-message").style.display = "none"; | 34 if (bowser.samsungBrowser) |
20 document.getElementById("install").style.display = "none"; | 35 { |
21 } | 36 // Assign more specific user agent (ua-android is already present) |
37 contentElement.classList.add("ua-samsung"); | |
38 | |
39 // change the Android install link to Samsung Browser | |
40 document | |
41 .getElementById("install-android") | |
42 .href = "https://play.google.com/store/apps/details?id=org.adblockplus .adblockplussbrowser"; | |
43 | |
44 // update the install button text in English *only* | |
45 if (locale == "en") | |
46 document | |
47 .getElementById("install-android") | |
48 .textContent = "Agree and Install for Samsung Internet"; | |
49 } | |
50 }); | |
22 </script> | 51 </script> |
23 {% endblock %} | 52 </head> |
24 | 53 |
25 <? include index ?> | 54 <? include index ?> |
LEFT | RIGHT |