Index: stats.js |
=================================================================== |
--- a/stats.js |
+++ b/stats.js |
@@ -10,17 +10,17 @@ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-/* global i18n, getPref, togglePref */ |
+/* global getPref, togglePref */ |
"use strict"; |
(function() |
{ |
let currentTab; |
const shareURL = "https://adblockplus.org/"; |
@@ -29,17 +29,17 @@ |
facebook: ["https://www.facebook.com/dialog/feed", { |
app_id: "475542399197328", |
link: shareURL, |
redirect_uri: "https://www.facebook.com/", |
ref: "adcounter", |
name: messageMark, |
actions: JSON.stringify([ |
{ |
- name: i18n.getMessage("stats_share_download"), |
+ name: chrome.i18n.getMessage("stats_share_download"), |
link: shareURL |
} |
]) |
}], |
gplus: ["https://plus.google.com/share", { |
url: shareURL |
}], |
twitter: ["https://twitter.com/intent/tweet", { |
@@ -54,17 +54,17 @@ |
let url = shareLinks[network][0]; |
let params = shareLinks[network][1]; |
let querystring = []; |
for (let key in params) |
{ |
let value = params[key]; |
if (value == messageMark) |
- value = i18n.getMessage("stats_share_message", blockedCount); |
+ value = chrome.i18n.getMessage("stats_share_message", blockedCount); |
querystring.push( |
encodeURIComponent(key) + "=" + encodeURIComponent(value) |
); |
} |
return url + "?" + querystring.join("&"); |
} |
function onLoad() |
@@ -95,37 +95,42 @@ |
{ |
let statsPage = document.getElementById("stats-page"); |
chrome.runtime.sendMessage({ |
type: "stats.getBlockedPerPage", |
tab: currentTab |
}, |
blockedPage => |
{ |
- i18n.setElementText(statsPage, "stats_label_page", |
- [blockedPage.toLocaleString()]); |
+ ext.i18n.setElementText(statsPage, "stats_label_page", |
+ [blockedPage.toLocaleString()]); |
}); |
let statsTotal = document.getElementById("stats-total"); |
getPref("blocked_total", blockedTotal => |
{ |
- i18n.setElementText(statsTotal, "stats_label_total", |
- [blockedTotal.toLocaleString()]); |
+ ext.i18n.setElementText(statsTotal, "stats_label_total", |
+ [blockedTotal.toLocaleString()]); |
}); |
} |
function share(ev) |
{ |
getPref("blocked_total", blockedTotal => |
{ |
// Easter Egg |
if (blockedTotal <= 9000 || blockedTotal >= 10000) |
+ { |
blockedTotal = blockedTotal.toLocaleString(); |
+ } |
else |
- blockedTotal = i18n.getMessage("stats_over", (9000).toLocaleString()); |
+ { |
+ blockedTotal = chrome.i18n.getMessage("stats_over", |
+ (9000).toLocaleString()); |
+ } |
chrome.tabs.create({ |
url: createShareLink(ev.target.dataset.social, blockedTotal) |
}); |
}); |
} |
function toggleIconNumber() |