Commit 4ad39b36 authored by Arthur Edelstein's avatar Arthur Edelstein Committed by Georg Koppen
Browse files

Bug 28540: Use new text for 2018 donation banner

parent 68ad9e3d
...@@ -72,7 +72,7 @@ var AboutTorListener = { ...@@ -72,7 +72,7 @@ var AboutTorListener = {
sendAsyncMessage(that.kAboutTorHideDonationBanner); sendAsyncMessage(that.kAboutTorHideDonationBanner);
}); });
}); });
bindPrefAndInit("extensions.torbutton.donation_banner_countdown", bindPrefAndInit("extensions.torbutton.donation_banner_countdown2",
countdown => { countdown => {
if (content.document && content.document.body) { if (content.document && content.document.body) {
content.document.body.setAttribute( content.document.body.setAttribute(
......
...@@ -37,15 +37,17 @@ window.addEventListener("pageshow", function() { ...@@ -37,15 +37,17 @@ window.addEventListener("pageshow", function() {
<div id="donation-banner-lines"> <div id="donation-banner-lines">
<div id="donation-banner-line1">&aboutTor.donationBanner.line1;</div> <div id="donation-banner-line1">&aboutTor.donationBanner.line1;</div>
<div id="donation-banner-line2" <div id="donation-banner-line2"
data-0="&aboutTor.donationBanner.line2a;" data-6="&aboutTor.donationBanner.line2e;"
data-1="&aboutTor.donationBanner.line2b;" data-7="&aboutTor.donationBanner.line2f;"
data-2="&aboutTor.donationBanner.line2c;" data-8="&aboutTor.donationBanner.line2g;"
data-3="&aboutTor.donationBanner.line2d;" data-9="&aboutTor.donationBanner.line2h;"
data-4="&aboutTor.donationBanner.line2e;" data-10="&aboutTor.donationBanner.line2i;"
data-5="&aboutTor.donationBanner.line2f;"> data-11="&aboutTor.donationBanner.line2j;">
&aboutTor.donationBanner.line2a; &aboutTor.donationBanner.line2e;
</div> </div>
<div id="donation-banner-line3">&aboutTor.donationBanner.line3;</div> <div id="donation-banner-line3"
data-b="&aboutTor.donationBanner.line3b;">
&aboutTor.donationBanner.line3;</div>
<a id="donation-banner-button" <a id="donation-banner-button"
href="https://www.torproject.org/donate/donate-sin-tbd0-0" href="https://www.torproject.org/donate/donate-sin-tbd0-0"
type="button" type="button"
...@@ -58,13 +60,17 @@ window.addEventListener("pageshow", function() { ...@@ -58,13 +60,17 @@ window.addEventListener("pageshow", function() {
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
<![CDATA[ <![CDATA[
let lineChoice = Math.floor(Math.random() * 6); let lineChoice = 6 + Math.floor(Math.random() * 6);
let line2 = document.getElementById("donation-banner-line2"); let line2 = document.getElementById("donation-banner-line2");
let line2text = line2.getAttribute(`data-${lineChoice}`); let line2text = line2.getAttribute(`data-${lineChoice}`);
let line2pieces = line2text.split(" "); let line2pieces = line2text.split(" ");
let line2end = '<span>' + line2pieces.pop() + '</span>'; let line2end = '<span>' + line2pieces.pop() + '</span>';
line2pieces.push(line2end); line2pieces.push(line2end);
line2.innerHTML = line2pieces.join(" "); line2.innerHTML = line2pieces.join(" ");
line3 = document.getElementById("donation-banner-line3");
if (lineChoice === 11) {
line3.innerHTML = line3.getAttribute("data-b");
}
let buttonChoice = Math.floor(Math.random() * 2); let buttonChoice = Math.floor(Math.random() * 2);
let button = document.getElementById("donation-banner-button"); let button = document.getElementById("donation-banner-button");
button.innerHTML = button.getAttribute(`data-${buttonChoice}`); button.innerHTML = button.getAttribute(`data-${buttonChoice}`);
......
...@@ -17,7 +17,7 @@ const k_tb_last_browser_version_pref = "extensions.torbutton.lastBrowserVersion" ...@@ -17,7 +17,7 @@ const k_tb_last_browser_version_pref = "extensions.torbutton.lastBrowserVersion"
const k_tb_browser_update_needed_pref = "extensions.torbutton.updateNeeded"; const k_tb_browser_update_needed_pref = "extensions.torbutton.updateNeeded";
const k_tb_last_update_check_pref = "extensions.torbutton.lastUpdateCheck"; const k_tb_last_update_check_pref = "extensions.torbutton.lastUpdateCheck";
const k_tb_tor_check_failed_topic = "Torbutton:TorCheckFailed"; const k_tb_tor_check_failed_topic = "Torbutton:TorCheckFailed";
const k_tb_donation_banner_countdown = "extensions.torbutton.donation_banner_countdown"; const k_tb_donation_banner_countdown = "extensions.torbutton.donation_banner_countdown2";
var m_tb_prefs = Services.prefs; var m_tb_prefs = Services.prefs;
......
...@@ -6,7 +6,7 @@ pref("extensions.torbutton.logmethod",1); // 0=stdout, 1=errorconsole, 2=debuglo ...@@ -6,7 +6,7 @@ pref("extensions.torbutton.logmethod",1); // 0=stdout, 1=errorconsole, 2=debuglo
pref("extensions.torbutton.display_circuit", true); pref("extensions.torbutton.display_circuit", true);
pref("extensions.torbutton@torproject.org.description", "chrome://torbutton/locale/torbutton.properties"); pref("extensions.torbutton@torproject.org.description", "chrome://torbutton/locale/torbutton.properties");
pref("extensions.torbutton.updateNeeded", false); pref("extensions.torbutton.updateNeeded", false);
pref("extensions.torbutton.donation_banner_countdown", 12); pref("extensions.torbutton.donation_banner_countdown2", 12);
// Tor check and proxy prefs // Tor check and proxy prefs
pref("extensions.torbutton.test_enabled",true); pref("extensions.torbutton.test_enabled",true);
......
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