[tor-commits] [torbutton/master] Bug 23887: Update banner locales and Mozilla text
gk at torproject.org
gk at torproject.org
Tue Oct 17 11:17:41 UTC 2017
commit 235da9c962e5e2b06ed7c73259d51d723433b5f0
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date: Mon Oct 16 23:09:56 2017 -0700
Bug 23887: Update banner locales and Mozilla text
Also: change donation link to
https://www.torproject.org/donate/donate-pdr-tbb-[locale]
---
src/chrome/content/aboutTor/aboutTor.xhtml | 3 ++-
src/chrome/content/aboutTor/donation_banner.js | 4 +++-
src/chrome/skin/donation_banner.css | 23 ++++++++++++++++++++---
src/modules/donation-banner.js | 16 ++++++++++------
4 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/src/chrome/content/aboutTor/aboutTor.xhtml b/src/chrome/content/aboutTor/aboutTor.xhtml
index 367f9a6..248df11 100644
--- a/src/chrome/content/aboutTor/aboutTor.xhtml
+++ b/src/chrome/content/aboutTor/aboutTor.xhtml
@@ -37,8 +37,9 @@ window.addEventListener("pageshow", function() {
<div id="banner-contents-container">
<div id="banner-tagline"><span></span></div>
<div id="banner-slogan"><span></span></div>
+ <div id="banner-mozilla"><span></span></div>
<a id="banner-donate-button-link"
- href="https://www.torproject.org/donate/donate-tbb">
+ href="https://www.torproject.org/donate/donate-pdr-tbb">
<div id="banner-donate-button">
<div id="banner-donate-button-inner">
<span></span>
diff --git a/src/chrome/content/aboutTor/donation_banner.js b/src/chrome/content/aboutTor/donation_banner.js
index 1c95822..391c28f 100644
--- a/src/chrome/content/aboutTor/donation_banner.js
+++ b/src/chrome/content/aboutTor/donation_banner.js
@@ -46,6 +46,7 @@ let avoidWidows = function (element) {
let updateTextSizes = function () {
fitTextInElement(sel("#banner-tagline"));
fitTextInElement(sel("#banner-slogan"));
+ fitTextInElement(sel("#banner-mozilla"));
fitTextInElement(sel("#banner-donate-button-inner"));
avoidWidows(sel("#banner-tagline span"));
};
@@ -54,10 +55,11 @@ let updateTextSizes = function () {
let randomInteger = max => Math.floor(max * Math.random());
// The main donation banner function.
-let runDonationBanner = function ({ taglines, slogan, donate, shortLocale }) {
+let runDonationBanner = function ({ taglines, slogan, mozilla, donate, shortLocale }) {
try {
sel("#banner-tagline span").innerText = taglines[randomInteger(taglines.length)];
sel("#banner-slogan span").innerText = slogan;
+ sel("#banner-mozilla span").innerText = mozilla;
let donateButtonText = sel("#banner-donate-button-inner span");
let rtl = window.getComputedStyle(donateButtonText).direction === "rtl";
donateButtonText.innerHTML = donate + " " + (rtl ? "◀" : "▶");
diff --git a/src/chrome/skin/donation_banner.css b/src/chrome/skin/donation_banner.css
index 8580066..c91f0e5 100644
--- a/src/chrome/skin/donation_banner.css
+++ b/src/chrome/skin/donation_banner.css
@@ -58,8 +58,8 @@
right: 85px;
}
#banner-slogan {
- align-items: start;
- bottom: 0px;
+ align-items: center;
+ bottom: 30px;
color: #f8f8a0;
display: flex;
font-family: monospace;
@@ -68,13 +68,30 @@
position: absolute;
right: 285px;
text-align: start;
- top: 100px;
+ top: 90px;
white-space: nowrap;
}
#banner-slogan:-moz-dir(rtl) {
left: 285px;
right: 85px;
}
+#banner-mozilla {
+ align-items: center;
+ bottom: 5px;
+ color: white;
+ display: flex;
+ font-family: sans-serif;
+ left: 85px;
+ position: absolute;
+ right: 285px;
+ text-align: start;
+ top: 120px;
+ white-space: nowrap;
+}
+#banner-mozilla:-moz-dir(rtl) {
+ left: 285px;
+ right: 85px;
+}
#banner-donate-button {
background-color: #13a513;
border: 0px;
diff --git a/src/modules/donation-banner.js b/src/modules/donation-banner.js
index bb35e86..3a954e5 100644
--- a/src/modules/donation-banner.js
+++ b/src/modules/donation-banner.js
@@ -9,14 +9,17 @@ Cu.import("resource://gre/modules/Services.jsm");
const kBannerLocales = [
"bg",
"da",
+ "de",
"el",
"en",
"es",
"fr",
- "fr_CA",
"is",
"it",
+ "pt",
"nb",
+ "ru",
+ "sv",
"tr",
];
@@ -46,7 +49,7 @@ const gStringBundle = Services.strings.createBundle(kPropertiesURL);
// Check if we should show the banner, depends on
// browser locale, current date, and how many times
// we have already shown the banner.
-const shouldShowBanner = function ({ locale, shortLocale }) {
+const shouldShowBanner = function (shortLocale) {
try {
// If our override test pref is true, then just show the banner regardless.
if (Services.prefs.getBoolPref("extensions.torbutton.testBanner", false)) {
@@ -58,7 +61,7 @@ const shouldShowBanner = function ({ locale, shortLocale }) {
return false;
}
// Only show banner when we have that locale and if a donation redirect exists.
- if (kBannerLocales.indexOf(locale) === -1 ||
+ if (kBannerLocales.indexOf(shortLocale) === -1 ||
kDonationPageLocales.indexOf(shortLocale) === -1) {
return false;
}
@@ -92,7 +95,7 @@ var bannerData = function () {
// Read short locale.
let locale = Services.prefs.getCharPref("general.useragent.locale");
let shortLocale = locale.match(/[a-zA-Z]+/)[0].toLowerCase();
- if (!shouldShowBanner({ locale, shortLocale })) {
+ if (!shouldShowBanner(shortLocale)) {
return null;
}
// Load tag lines.
@@ -102,10 +105,11 @@ var bannerData = function () {
"aboutTor.donationBanner.tagline" + (index + 1));
taglines.push(tagline);
}
- // Read slogan and donate button text.
+ // Read slogan, mozilla, and donate button text.
let slogan = gStringBundle.GetStringFromName("aboutTor.donationBanner.slogan");
+ let mozilla = gStringBundle.GetStringFromName("aboutTor.donationBanner.mozilla");
let donate = gStringBundle.GetStringFromName("aboutTor.donationBanner.donate");
- return JSON.stringify({ taglines, slogan, donate, shortLocale });
+ return JSON.stringify({ taglines, slogan, mozilla, donate, shortLocale });
};
// Export utility functions for external use.
More information about the tor-commits
mailing list