biancadanforth / tracking-protection-shield-study

A Shield study to determine the optimal messaging, if any, for Tracking Protection in Firefox.
0 stars 3 forks source link

Add comma separation for large values for trackers and ads blocked on `about:newtab` #131

Closed biancadanforth closed 6 years ago

biancadanforth commented 6 years ago

Ex: "1000" becomes "1,000" and so on

pdehaan commented 6 years ago

Possibly just:

diff --git a/addon/content/new-tab-variation.js b/addon/content/new-tab-variation.js
index cde3e3d..4f2db75 100644
--- a/addon/content/new-tab-variation.js
+++ b/addon/content/new-tab-variation.js
@@ -144,8 +144,8 @@ class TrackingProtectionStudy {
       parseInt(state.timeSaved, this.RADIX)
     );
     let message = this.newTabMessage;
-    message = message.replace("${blockedRequests}", parseInt(state.blockedResources, this.RADIX));
-    message = message.replace("${blockedAds}", parseInt(state.blockedAds, this.RADIX));
+    message = message.replace("${blockedRequests}", parseInt(state.blockedResources, this.RADIX).toLocaleString());
+    message = message.replace("${blockedAds}", parseInt(state.blockedAds, this.RADIX).toLocaleString());
     message = message.replace("${time}", parsedTime);
     return message;
   }

tolocalestring