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 |
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 /** @module icon */ | 18 /** @module icon */ |
19 | 19 |
20 const numberOfFrames = 10; | 20 const numberOfFrames = 10; |
21 | 21 |
22 let whitelistedState = new ext.PageMap(); | 22 let whitelistedState = new ext.PageMap(); |
23 let notificationType = null; | 23 let notificationType = null; |
24 let animationInterval = null; | 24 let animationInterval = null; |
25 let animationStep = 0; | 25 let animationStep = 0; |
26 | 26 |
| 27 exports.basePath = "icons/abp-$size"; |
| 28 |
27 function getIconPath(whitelisted) | 29 function getIconPath(whitelisted) |
28 { | 30 { |
29 let filename = "icons/abp-$size"; | 31 let filename = exports.basePath; |
30 | 32 |
31 // If the current page is whitelisted, pick an icon that indicates that | 33 // If the current page is whitelisted, pick an icon that indicates that |
32 // Adblock Plus is disabled, however not when the notification icon has | 34 // Adblock Plus is disabled, however not when the notification icon has |
33 // full opacity, or on Safari where icons are genrally grayscale-only. | 35 // full opacity, or on Safari where icons are genrally grayscale-only. |
34 if (whitelisted && animationStep < numberOfFrames && require("info").platform
!= "safari") | 36 if (whitelisted && animationStep < numberOfFrames && require("info").platform
!= "safari") |
35 filename += "-whitelisted"; | 37 filename += "-whitelisted"; |
36 | 38 |
37 // If the icon is currently animating to indicate a pending notification, | 39 // If the icon is currently animating to indicate a pending notification, |
38 // pick the icon for the corresponing notification type and animation frame. | 40 // pick the icon for the corresponing notification type and animation frame. |
39 if (notificationType && animationStep > 0) | 41 if (notificationType && animationStep > 0) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 exports.stopIconAnimation = function() | 120 exports.stopIconAnimation = function() |
119 { | 121 { |
120 if (animationInterval != null) | 122 if (animationInterval != null) |
121 { | 123 { |
122 clearInterval(animationInterval); | 124 clearInterval(animationInterval); |
123 animationInterval = null; | 125 animationInterval = null; |
124 } | 126 } |
125 | 127 |
126 notificationType = null; | 128 notificationType = null; |
127 }; | 129 }; |
OLD | NEW |