 Issue 29766571:
  Fixes #55 - Updated install button on Samsung Browser for Android  (Closed) 
  Base URL: https://hg.adblockplus.org/web.adblockplus.org
    
  
    Issue 29766571:
  Fixes #55 - Updated install button on Samsung Browser for Android  (Closed) 
  Base URL: https://hg.adblockplus.org/web.adblockplus.org| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 1 <head> | 1 <head> | 
| 2 <style> | 2 <style> | 
| 3 /* Hide TOS & Install on android page when not using Samsung Browser */ | 3 /* Hide TOS & Install on android page when not using Samsung Browser */ | 
| 4 .android:not(.ua-samsung) #terms-message, | 4 .android:not(.ua-samsung) #terms-message, | 
| 
juliandoucette
2018/05/01 11:21:56
Detail: `.android` is applied to the android page
 | |
| 5 .android:not(.ua-samsung) #install, | 5 .android:not(.ua-samsung) #install, | 
| 6 /* Hide other platforms on android page when using Android */ | 6 /* Hide other platforms on android page when using Android */ | 
| 7 .ua-andriod.android #other-platform, | 7 .ua-andriod.android #other-platform, | 
| 
juliandoucette
2018/05/01 11:21:56
Detail: ua-* classes are injected by the server (w
 | 
ire
2018/05/02 08:06:59
Typo in "ua-android"
 | 
| 8 /* Hide ABB banner on android page when using Samsung Browser */ | 8 /* Hide ABB banner on android page when using Samsung Browser */ | 
| 9 #content.ua-android.ua-samsung #abb-banner | 9 #content.ua-android.ua-samsung #abb-banner | 
| 
juliandoucette
2018/05/01 11:21:56
Detail: `.ua-android` is injected by the server. `
 | |
| 10 { | 10 { | 
| 11 display: none; | 11 display: none; | 
| 12 } | 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 } | |
| 13 </style> | 19 </style> | 
| 14 <script src="/js/vendor/bowser.js"></script> | 20 <script src="/js/vendor/bowser.js"></script> | 
| 15 <script> | 21 <script> | 
| 16 document.addEventListener("DOMContentLoaded", function() | 22 document.addEventListener("DOMContentLoaded", function() | 
| 17 { | 23 { | 
| 18 if (!bowser instanceof Object) return; | 24 if (!bowser instanceof Object) return; | 
| 19 | 25 | 
| 20 var locale = "{{ locale }}"; | 26 var locale = "{{ locale }}"; | 
| 21 | 27 | 
| 22 var content = document.getElementById("content"); | 28 var contentElement = document.getElementById("content"); | 
| 
ire
2018/05/02 08:06:59
Coding style -> "No hungarian notation"
 | |
| 23 | 29 | 
| 24 // Replicating server behaviour on the frontend for testing | 30 // Replicating server behaviour on the frontend for testing | 
| 25 if (bowser.android) | 31 if (bowser.android) | 
| 26 content.classList.add("ua-android"); | 32 contentElement.classList.add("ua-android"); | 
| 27 | 33 | 
| 28 if (bowser.samsungBrowser) | 34 if (bowser.samsungBrowser) | 
| 29 { | 35 { | 
| 30 // Assign more specific user agent (ua-android is already present) | 36 // Assign more specific user agent (ua-android is already present) | 
| 31 document | 37 contentElement.classList.add("ua-samsung"); | 
| 
juliandoucette
2018/05/01 11:21:56
Oops... I'll use the content variable above in the
 | |
| 32 .getElementById("content") | |
| 33 .classList.add("ua-samsung"); | |
| 34 | 38 | 
| 35 // change the Android install link to Samsung Browser | 39 // change the Android install link to Samsung Browser | 
| 36 document | 40 document | 
| 37 .getElementById("install-android") | 41 .getElementById("install-android") | 
| 38 .href = "https://play.google.com/store/apps/details?id=org.adblockplus .adblockplussbrowser"; | 42 .href = "https://play.google.com/store/apps/details?id=org.adblockplus .adblockplussbrowser"; | 
| 39 | 43 | 
| 40 // update the install button text in English *only* | 44 // update the install button text in English *only* | 
| 41 if (locale == "en") | 45 if (locale == "en") | 
| 42 document | 46 document | 
| 43 .getElementById("install-android") | 47 .getElementById("install-android") | 
| 44 .textContent = "Agree and Install for Samsung Internet"; | 48 .textContent = "Agree and Install for Samsung Internet"; | 
| 45 } | 49 } | 
| 46 }); | 50 }); | 
| 47 </script> | 51 </script> | 
| 48 </head> | 52 </head> | 
| 49 | 53 | 
| 50 <? include index ?> | 54 <? include index ?> | 
| LEFT | RIGHT |