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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 }, 15000); | 86 }, 15000); |
87 } | 87 } |
88 | 88 |
89 /** | 89 /** |
90 * Set the browser action icon for the given page, indicating whether | 90 * Set the browser action icon for the given page, indicating whether |
91 * adblocking is active there, and considering the icon animation. | 91 * adblocking is active there, and considering the icon animation. |
92 * | 92 * |
93 * @param {Page} page The page to set the browser action icon for | 93 * @param {Page} page The page to set the browser action icon for |
94 * @param {Boolean} whitelisted Whether the page has been whitelisted | 94 * @param {Boolean} whitelisted Whether the page has been whitelisted |
95 */ | 95 */ |
96 function updateIcon(page, whitelisted) | 96 exports.updateIcon = function(page, whitelisted) |
97 { | 97 { |
98 page.browserAction.setIcon(getIconPath(whitelisted)); | 98 page.browserAction.setIcon(getIconPath(whitelisted)); |
99 whitelistedState.set(page, whitelisted); | 99 whitelistedState.set(page, whitelisted); |
100 } | 100 }; |
101 exports.updateIcon = updateIcon; | |
102 | 101 |
103 /** | 102 /** |
104 * Starts to animate the browser action icon to indicate a pending notifcation. | 103 * Starts to animate the browser action icon to indicate a pending notifcation. |
105 * | 104 * |
106 * @param {string} type The notification type (i.e: "information" or "critical"
) | 105 * @param {string} type The notification type (i.e: "information" or "critical"
) |
107 */ | 106 */ |
108 function startIconAnimation(type) | 107 exports.startIconAnimation = function(type) |
109 { | 108 { |
110 notificationType = type; | 109 notificationType = type; |
111 | 110 |
112 if (animationInterval == null) | 111 if (animationInterval == null) |
113 animationInterval = runAnimation(); | 112 animationInterval = runAnimation(); |
114 } | 113 }; |
115 exports.startIconAnimation = startIconAnimation; | |
116 | 114 |
117 /** | 115 /** |
118 * Stops to animate the browser action icon. | 116 * Stops to animate the browser action icon. |
119 */ | 117 */ |
120 function stopIconAnimation() | 118 exports.stopIconAnimation = function() |
121 { | 119 { |
122 if (animationInterval != null) | 120 if (animationInterval != null) |
123 { | 121 { |
124 clearInterval(animationInterval); | 122 clearInterval(animationInterval); |
125 animationInterval = null; | 123 animationInterval = null; |
126 } | 124 } |
127 | 125 |
128 notificationType = null; | 126 notificationType = null; |
129 } | 127 }; |
130 exports.stopIconAnimation = stopIconAnimation; | |
OLD | NEW |