Commit 235da9c9 authored by Arthur Edelstein's avatar Arthur Edelstein
Browse files

Bug 23887: Update banner locales and Mozilla text

Also: change donation link to
https://www.torproject.org/donate/donate-pdr-tbb-[locale]
parent c2049a58
......@@ -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>
......
......@@ -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 + "&#160;" + (rtl ? "&#9664;" : "&#9654;");
......
......@@ -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;
......
......@@ -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.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment