Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: stats.js

Issue 29374674: Issue 4864 - Start using ESLint for adblockpluschrome (Closed)
Patch Set: Created Feb. 7, 2017, 4:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « qunit/tests/versionComparator.js ('k') | subscriptionLink.postload.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 /* global i18n */
19
18 "use strict"; 20 "use strict";
19 21
20 { 22 {
21 const {require} = ext.backgroundPage.getWindow(); 23 const {require} = ext.backgroundPage.getWindow();
22 24
23 const {getBlockedPerPage} = require("stats"); 25 const {getBlockedPerPage} = require("stats");
24 const {FilterNotifier} = require("filterNotifier"); 26 const {FilterNotifier} = require("filterNotifier");
25 const {Prefs} = require("prefs"); 27 const {Prefs} = require("prefs");
26 28
27 let currentPage; 29 let currentPage;
(...skipping 28 matching lines...) Expand all
56 { 58 {
57 let url = shareLinks[network][0]; 59 let url = shareLinks[network][0];
58 let params = shareLinks[network][1]; 60 let params = shareLinks[network][1];
59 61
60 let querystring = []; 62 let querystring = [];
61 for (let key in params) 63 for (let key in params)
62 { 64 {
63 let value = params[key]; 65 let value = params[key];
64 if (value == messageMark) 66 if (value == messageMark)
65 value = i18n.getMessage("stats_share_message", blockedCount); 67 value = i18n.getMessage("stats_share_message", blockedCount);
66 querystring.push(encodeURIComponent(key) + "=" + encodeURIComponent(value) ); 68 querystring.push(
69 encodeURIComponent(key) + "=" + encodeURIComponent(value)
70 );
67 } 71 }
68 return url + "?" + querystring.join("&"); 72 return url + "?" + querystring.join("&");
69 } 73 }
70 74
71 function onLoad() 75 function onLoad()
72 { 76 {
73 document.getElementById("share-box").addEventListener("click", share, false) ; 77 document.getElementById("share-box").addEventListener("click", share,
78 false);
74 let showIconNumber = document.getElementById("show-iconnumber"); 79 let showIconNumber = document.getElementById("show-iconnumber");
75 showIconNumber.setAttribute("aria-checked", Prefs.show_statsinicon); 80 showIconNumber.setAttribute("aria-checked", Prefs.show_statsinicon);
76 showIconNumber.addEventListener("click", toggleIconNumber, false); 81 showIconNumber.addEventListener("click", toggleIconNumber, false);
77 document.querySelector("label[for='show-iconnumber']").addEventListener("cli ck", toggleIconNumber, false); 82 document.querySelector("label[for='show-iconnumber']").addEventListener(
83 "click", toggleIconNumber, false
84 );
78 85
79 // Update stats 86 // Update stats
80 ext.pages.query({active: true, lastFocusedWindow: true}, pages => 87 ext.pages.query({active: true, lastFocusedWindow: true}, pages =>
81 { 88 {
82 currentPage = pages[0]; 89 currentPage = pages[0];
83 updateStats(); 90 updateStats();
84 91
85 FilterNotifier.on("filter.hitCount", updateStats); 92 FilterNotifier.on("filter.hitCount", updateStats);
86 93
87 document.getElementById("stats-container").removeAttribute("hidden"); 94 document.getElementById("stats-container").removeAttribute("hidden");
(...skipping 24 matching lines...) Expand all
112 blocked = blocked.toLocaleString(); 119 blocked = blocked.toLocaleString();
113 else 120 else
114 blocked = i18n.getMessage("stats_over", (9000).toLocaleString()); 121 blocked = i18n.getMessage("stats_over", (9000).toLocaleString());
115 122
116 ext.pages.open(createShareLink(ev.target.dataset.social, blocked)); 123 ext.pages.open(createShareLink(ev.target.dataset.social, blocked));
117 } 124 }
118 125
119 function toggleIconNumber() 126 function toggleIconNumber()
120 { 127 {
121 Prefs.show_statsinicon = !Prefs.show_statsinicon; 128 Prefs.show_statsinicon = !Prefs.show_statsinicon;
122 document.getElementById("show-iconnumber").setAttribute("aria-checked", Pref s.show_statsinicon); 129 document.getElementById("show-iconnumber").setAttribute(
130 "aria-checked", Prefs.show_statsinicon
131 );
123 } 132 }
124 133
125 document.addEventListener("DOMContentLoaded", onLoad, false); 134 document.addEventListener("DOMContentLoaded", onLoad, false);
126 window.addEventListener("unload", onUnload, false); 135 window.addEventListener("unload", onUnload, false);
127 } 136 }
OLDNEW
« no previous file with comments | « qunit/tests/versionComparator.js ('k') | subscriptionLink.postload.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld