commit 9ea41dcdc38c79368a0909f4a64fcb865bd39af2 Author: Matthew Finkel sysrqb@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-$%7BaLocale%7D%60; + + if (content.document.body.getAttribute("mobile")) { + ey2019_elem_id = "ey2019_donate_mobile"; + ey2019_locale_url = + `https://www.torproject.org/donate/donate-tbi-mobile-$%7BaLocale%7D%60; + } + content.document - .getElementById("ey2019_donate") - .setAttribute( - "href", - `https://www.torproject.org/donate/donate-tbi-$%7BaLocale%7D%60 - ); + .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; +}
tor-commits@lists.torproject.org