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

gk at torproject.org gk at torproject.org
Wed Dec 5 08:40:04 UTC 2018


commit 905d12774d553372d8db617b7fcfd9cdc91e78d6
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 e8f5ffa2..ccb9139d 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 9256748e..52fab695 100644
--- a/src/chrome/content/aboutTor/aboutTor.xhtml
+++ b/src/chrome/content/aboutTor/aboutTor.xhtml
@@ -36,15 +36,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"
@@ -57,13 +59,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 fc1a38d8..864d1d2e 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -19,7 +19,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 e9496c08..b991a3ae 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