LEFT | RIGHT |
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 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 let frames = {}; | 117 let frames = {}; |
118 let canvas = document.createElement("canvas"); | 118 let canvas = document.createElement("canvas"); |
119 let context = canvas.getContext("2d"); | 119 let context = canvas.getContext("2d"); |
120 | 120 |
121 for (let whitelisted of [false, true]) | 121 for (let whitelisted of [false, true]) |
122 { | 122 { |
123 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10) | 123 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10) |
124 { | 124 { |
125 let imageData = {}; | 125 let imageData = {}; |
126 for (let size of [16, 19, 20, 32, 38, 40]) | 126 let sizes = [16, 19, 20, 32, 38, 40]; |
| 127 for (let size of sizes) |
127 { | 128 { |
128 canvas.width = size; | 129 canvas.width = size; |
129 canvas.height = size; | 130 canvas.height = size; |
130 context.globalAlpha = 1; | 131 context.globalAlpha = 1; |
131 context.drawImage(images[size]["base"][whitelisted | 0], 0, 0); | 132 context.drawImage(images[size]["base"][whitelisted | 0], 0, 0); |
132 context.globalAlpha = opacity; | 133 context.globalAlpha = opacity; |
133 context.drawImage(images[size]["overlay"], 0, 0); | 134 context.drawImage(images[size]["overlay"], 0, 0); |
134 imageData[size] = context.getImageData(0, 0, size, size); | 135 imageData[size] = context.getImageData(0, 0, size, size); |
135 } | 136 } |
136 frames["" + opacity + whitelisted] = imageData; | 137 frames["" + opacity + whitelisted] = imageData; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 clearInterval(interval); | 227 clearInterval(interval); |
227 resolve(); | 228 resolve(); |
228 return; | 229 return; |
229 } | 230 } |
230 | 231 |
231 animateIcon(type, frames); | 232 animateIcon(type, frames); |
232 }, 10000); | 233 }, 10000); |
233 }); | 234 }); |
234 }); | 235 }); |
235 }; | 236 }; |
LEFT | RIGHT |