[tbb-commits] [torbutton/maint-9.0] Bug 30783 - Use mobile EOY links on Android

sysrqb at torproject.org sysrqb at torproject.org
Fri Jan 3 20:38:36 UTC 2020


commit 9ea41dcdc38c79368a0909f4a64fcb865bd39af2
Author: Matthew Finkel <sysrqb at torproject.org>
Date:   Thu Oct 31 17:07:30 2019 +0000

    Bug 30783 - Use mobile EOY links on Android
---
 chrome/content/aboutTor/aboutTor-content.js | 18 ++++++++++++------
 chrome/content/aboutTor/aboutTor.xhtml      |  1 +
 chrome/skin/aboutTor.css                    | 10 ++++++++++
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/chrome/content/aboutTor/aboutTor-content.js b/chrome/content/aboutTor/aboutTor-content.js
index 23f22406..18bc40f9 100644
--- a/chrome/content/aboutTor/aboutTor-content.js
+++ b/chrome/content/aboutTor/aboutTor-content.js
@@ -18,7 +18,6 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 let { bindPrefAndInit, show_torbrowser_manual } = ChromeUtils.import("resource://torbutton/modules/utils.js", {});
 
-
 var AboutTorListener = {
   kAboutTorLoadedMessage: "AboutTor:Loaded",
   kAboutTorChromeDataMessage: "AboutTor:ChromeData",
@@ -129,12 +128,19 @@ var AboutTorListener = {
                        + tbbVersion));
     } catch (e) {}
 
+    let ey2019_elem_id = "ey2019_donate";
+    let ey2019_locale_url =
+        `https://www.torproject.org/donate/donate-tbi-${aLocale}`;
+
+    if (content.document.body.getAttribute("mobile")) {
+      ey2019_elem_id = "ey2019_donate_mobile";
+      ey2019_locale_url =
+        `https://www.torproject.org/donate/donate-tbi-mobile-${aLocale}`;
+    }
+
     content.document
-      .getElementById("ey2019_donate")
-      .setAttribute(
-        "href",
-        `https://www.torproject.org/donate/donate-tbi-${aLocale}`
-      );
+      .getElementById(ey2019_elem_id)
+      .setAttribute("href", ey2019_locale_url);
   }
 };
 
diff --git a/chrome/content/aboutTor/aboutTor.xhtml b/chrome/content/aboutTor/aboutTor.xhtml
index 5f4b2bf7..e668b34e 100644
--- a/chrome/content/aboutTor/aboutTor.xhtml
+++ b/chrome/content/aboutTor/aboutTor.xhtml
@@ -59,6 +59,7 @@ window.addEventListener("pageshow", function() {
           </div>
           <div id="ey2019_3">
             <a id="ey2019_donate" href="https://www.torproject.org/donate/donate-tbi-default">&aboutTor.donationBanner.buttonA;</a>
+            <a id="ey2019_donate_mobile" href="https://www.torproject.org/donate/donate-tbi-mobile-default">&aboutTor.donationBanner.buttonA;</a>
             <p id="ey2019_mozilla">&aboutTor.ey2019.mozilla;</p>
           </div>
         </div>
diff --git a/chrome/skin/aboutTor.css b/chrome/skin/aboutTor.css
index 6c7276f0..28291d16 100644
--- a/chrome/skin/aboutTor.css
+++ b/chrome/skin/aboutTor.css
@@ -396,6 +396,7 @@ body[ey2019] .torcontent-logo {
   text-align: left;
 }
 
+#ey2019_donate_mobile,
 #ey2019_donate {
   border: 3px solid blueViolet;
   background: black;
@@ -411,6 +412,7 @@ body[ey2019] .torcontent-logo {
   vertical-align: super;
 }
 
+#ey2019_donate_mobile,
 #ey2019_donate:hover {
   background: blueViolet;
   color: black;
@@ -444,3 +446,11 @@ body:not([ey2019]) .showIfEY2019,
 body[ey2019] .hideIfEY2019 {
   display: none;
 }
+
+body:not([mobile]) #ey2019_donate_mobile {
+  display: none;
+}
+
+body[mobile] #ey2019_donate {
+  display: none;
+}





More information about the tbb-commits mailing list