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

Unified Diff: pages/android.tmpl

Issue 29766571: Fixes #55 - Updated install button on Samsung Browser for Android (Closed) Base URL: https://hg.adblockplus.org/web.adblockplus.org
Patch Set: Addressed #3 Created May 1, 2018, 11:10 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | static/js/vendor/bowser.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pages/android.tmpl
===================================================================
rename from pages/android.md
rename to pages/android.tmpl
--- a/pages/android.md
+++ b/pages/android.tmpl
@@ -1,1 +1,50 @@
+<head>
+ <style>
+ /* Hide TOS & Install on android page when not using Samsung Browser */
+ .android:not(.ua-samsung) #terms-message,
juliandoucette 2018/05/01 11:21:56 Detail: `.android` is applied to the android page
+ .android:not(.ua-samsung) #install,
+ /* Hide other platforms on android page when using Android */
+ .ua-andriod.android #other-platform,
juliandoucette 2018/05/01 11:21:56 Detail: ua-* classes are injected by the server (w
+ /* Hide ABB banner on android page when using Samsung Browser */
+ #content.ua-android.ua-samsung #abb-banner
juliandoucette 2018/05/01 11:21:56 Detail: `.ua-android` is injected by the server. `
+ {
+ display: none;
+ }
+ </style>
+ <script src="/js/vendor/bowser.js"></script>
+ <script>
+ document.addEventListener("DOMContentLoaded", function()
+ {
+ if (!bowser instanceof Object) return;
+
+ var locale = "{{ locale }}";
+
+ var content = document.getElementById("content");
+
+ // Replicating server behaviour on the frontend for testing
+ if (bowser.android)
+ content.classList.add("ua-android");
+
+ if (bowser.samsungBrowser)
+ {
+ // Assign more specific user agent (ua-android is already present)
+ document
juliandoucette 2018/05/01 11:21:56 Oops... I'll use the content variable above in the
+ .getElementById("content")
+ .classList.add("ua-samsung");
+
+ // change the Android install link to Samsung Browser
+ document
+ .getElementById("install-android")
+ .href = "https://play.google.com/store/apps/details?id=org.adblockplus.adblockplussbrowser";
+
+ // update the install button text in English *only*
+ if (locale == "en")
+ document
+ .getElementById("install-android")
+ .textContent = "Agree and Install for Samsung Internet";
+ }
+ });
+ </script>
+</head>
+
<? include index ?>
« no previous file with comments | « no previous file | static/js/vendor/bowser.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld