| OLD | NEW |
| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 let badgeColor = "#646464"; | 24 let badgeColor = "#646464"; |
| 25 let statsPerPage = new ext.PageMap(); | 25 let statsPerPage = new ext.PageMap(); |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Get statistics for specified page | 28 * Get statistics for specified page |
| 29 * @param {String} key field key | 29 * @param {String} key field key |
| 30 * @param {Page} page field page | 30 * @param {Page} page field page |
| 31 * @return {Number} field value | 31 * @return {Number} field value |
| 32 */ | 32 */ |
| 33 let getStats = exports.getStats = function getStats(key, page) | 33 exports.getStats = function(key, page) |
| 34 { | 34 { |
| 35 if (!page) | 35 if (!page) |
| 36 return (key in Prefs.stats_total ? Prefs.stats_total[key] : 0); | 36 return (key in Prefs.stats_total ? Prefs.stats_total[key] : 0); |
| 37 | 37 |
| 38 let pageStats = statsPerPage.get(page); | 38 let pageStats = statsPerPage.get(page); |
| 39 return pageStats ? pageStats.blocked : 0; | 39 return pageStats ? pageStats.blocked : 0; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 FilterNotifier.addListener(function(action, item, newValue, oldValue, page) | 42 FilterNotifier.addListener(function(action, item, newValue, oldValue, page) |
| 43 { | 43 { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 color: badgeColor, | 98 color: badgeColor, |
| 99 number: pageStats.blocked | 99 number: pageStats.blocked |
| 100 }; | 100 }; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 page.browserAction.setBadge(badge); | 104 page.browserAction.setBadge(badge); |
| 105 } | 105 } |
| 106 }); | 106 }); |
| 107 }); | 107 }); |
| OLD | NEW |