[tbb-commits] [torbutton/master] Bug 28540: Use new text for 2018 donation banner

gk at torproject.org gk at torproject.org
Mon Dec 3 09:20:33 UTC 2018


commit 4ad39b362dd7692b5e24841c616f63a5ca2bc67a
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Tue Nov 20 17:25:48 2018 -0800

    Bug 28540: Use new text for 2018 donation banner
---
 src/chrome/content/aboutTor/aboutTor-content.js |  2 +-
 src/chrome/content/aboutTor/aboutTor.xhtml      | 24 +++++++++++++++---------
 src/chrome/content/torbutton.js                 |  2 +-
 src/defaults/preferences/preferences.js         |  2 +-
 4 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/chrome/content/aboutTor/aboutTor-content.js b/src/chrome/content/aboutTor/aboutTor-content.js
index d34bbe5c..e53266bd 100644
--- a/src/chrome/content/aboutTor/aboutTor-content.js
+++ b/src/chrome/content/aboutTor/aboutTor-content.js
@@ -72,7 +72,7 @@ var AboutTorListener = {
         sendAsyncMessage(that.kAboutTorHideDonationBanner);
       });
     });
-    bindPrefAndInit("extensions.torbutton.donation_banner_countdown",
+    bindPrefAndInit("extensions.torbutton.donation_banner_countdown2",
                     countdown => {
                       if (content.document && content.document.body) {
                         content.document.body.setAttribute(
diff --git a/src/chrome/content/aboutTor/aboutTor.xhtml b/src/chrome/content/aboutTor/aboutTor.xhtml
index 94dd13f3..5f5fccdc 100644
--- a/src/chrome/content/aboutTor/aboutTor.xhtml
+++ b/src/chrome/content/aboutTor/aboutTor.xhtml
@@ -37,15 +37,17 @@ window.addEventListener("pageshow", function() {
     <div id="donation-banner-lines">
       <div id="donation-banner-line1">&aboutTor.donationBanner.line1;</div>
       <div id="donation-banner-line2"
-           data-0="&aboutTor.donationBanner.line2a;"
-           data-1="&aboutTor.donationBanner.line2b;"
-           data-2="&aboutTor.donationBanner.line2c;"
-           data-3="&aboutTor.donationBanner.line2d;"
-           data-4="&aboutTor.donationBanner.line2e;"
-           data-5="&aboutTor.donationBanner.line2f;">
-        &aboutTor.donationBanner.line2a;
+           data-6="&aboutTor.donationBanner.line2e;"
+           data-7="&aboutTor.donationBanner.line2f;"
+           data-8="&aboutTor.donationBanner.line2g;"
+           data-9="&aboutTor.donationBanner.line2h;"
+           data-10="&aboutTor.donationBanner.line2i;"
+           data-11="&aboutTor.donationBanner.line2j;">
+        &aboutTor.donationBanner.line2e;
       </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"
          href="https://www.torproject.org/donate/donate-sin-tbd0-0"
          type="button"
@@ -58,13 +60,17 @@ window.addEventListener("pageshow", function() {
   </div>
 <script type="text/javascript">
  <![CDATA[
-    let lineChoice = Math.floor(Math.random() * 6);
+    let lineChoice = 6 + Math.floor(Math.random() * 6);
     let line2 = document.getElementById("donation-banner-line2");
     let line2text = line2.getAttribute(`data-${lineChoice}`);
     let line2pieces = line2text.split(" ");
     let line2end = '<span>' + line2pieces.pop() + '</span>';
     line2pieces.push(line2end);
     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 button = document.getElementById("donation-banner-button");
     button.innerHTML = button.getAttribute(`data-${buttonChoice}`);
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index ee13f461..8bd847f9 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -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_last_update_check_pref = "extensions.torbutton.lastUpdateCheck";
 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;
 
diff --git a/src/defaults/preferences/preferences.js b/src/defaults/preferences/preferences.js
index 9beb3993..eb055a65 100644
--- a/src/defaults/preferences/preferences.js
+++ b/src/defaults/preferences/preferences.js
@@ -6,7 +6,7 @@ pref("extensions.torbutton.logmethod",1); // 0=stdout, 1=errorconsole, 2=debuglo
 pref("extensions.torbutton.display_circuit", true);
 pref("extensions.torbutton at torproject.org.description", "chrome://torbutton/locale/torbutton.properties");
 pref("extensions.torbutton.updateNeeded", false);
-pref("extensions.torbutton.donation_banner_countdown", 12);
+pref("extensions.torbutton.donation_banner_countdown2", 12);
 
 // Tor check and proxy prefs
 pref("extensions.torbutton.test_enabled",true);



More information about the tbb-commits mailing list