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-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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 if (canUpdateIcon) | 78 if (canUpdateIcon) |
79 setIcon(page); | 79 setIcon(page); |
80 }); | 80 }); |
81 | 81 |
82 function renderFrames(notificationType) | 82 function renderFrames(notificationType) |
83 { | 83 { |
84 if (safariPlatform) | 84 if (safariPlatform) |
85 return Promise.resolve(null); | 85 return Promise.resolve(null); |
86 | 86 |
87 return Promise.all([ | 87 return Promise.all([ |
| 88 loadImage("icons/abp-16.png"), |
| 89 loadImage("icons/abp-16-whitelisted.png"), |
| 90 loadImage("icons/abp-16-notification-" + notificationType + ".png"), |
88 loadImage("icons/abp-19.png"), | 91 loadImage("icons/abp-19.png"), |
89 loadImage("icons/abp-19-whitelisted.png"), | 92 loadImage("icons/abp-19-whitelisted.png"), |
90 loadImage("icons/abp-19-notification-" + notificationType + ".png"), | 93 loadImage("icons/abp-19-notification-" + notificationType + ".png"), |
| 94 loadImage("icons/abp-20.png"), |
| 95 loadImage("icons/abp-20-whitelisted.png"), |
| 96 loadImage("icons/abp-20-notification-" + notificationType + ".png"), |
| 97 loadImage("icons/abp-32.png"), |
| 98 loadImage("icons/abp-32-whitelisted.png"), |
| 99 loadImage("icons/abp-32-notification-" + notificationType + ".png"), |
91 loadImage("icons/abp-38.png"), | 100 loadImage("icons/abp-38.png"), |
92 loadImage("icons/abp-38-whitelisted.png"), | 101 loadImage("icons/abp-38-whitelisted.png"), |
93 loadImage("icons/abp-38-notification-" + notificationType + ".png"), | 102 loadImage("icons/abp-38-notification-" + notificationType + ".png"), |
| 103 loadImage("icons/abp-40.png"), |
| 104 loadImage("icons/abp-40-whitelisted.png"), |
| 105 loadImage("icons/abp-40-notification-" + notificationType + ".png") |
94 ]).then(images => | 106 ]).then(images => |
95 { | 107 { |
96 let images = { | 108 let images = { |
97 19: { base: [images[0], images[1]], overlay: images[2] }, | 109 16: { base: [images[0], images[1]], overlay: images[2] }, |
98 38: { base: [images[3], images[4]], overlay: images[5] } | 110 19: { base: [images[3], images[4]], overlay: images[5] }, |
| 111 20: { base: [images[6], images[7]], overlay: images[8] }, |
| 112 32: { base: [images[9], images[10]], overlay: images[11] }, |
| 113 38: { base: [images[12], images[13]], overlay: images[14] }, |
| 114 40: { base: [images[15], images[16]], overlay: images[17] } |
99 }; | 115 }; |
100 | 116 |
101 let frames = {}; | 117 let frames = {}; |
102 let canvas = document.createElement("canvas"); | 118 let canvas = document.createElement("canvas"); |
103 let context = canvas.getContext("2d"); | 119 let context = canvas.getContext("2d"); |
104 | 120 |
105 for (let whitelisted of [false, true]) | 121 for (let whitelisted of [false, true]) |
106 { | 122 { |
107 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10) | 123 for (let i = 0, opacity = 0; i <= 10; opacity = ++i / 10) |
108 { | 124 { |
109 let imageData = {}; | 125 let imageData = {}; |
110 for (let size of [19, 38]) | 126 for (let size of [16, 19, 20, 32, 38, 40]) |
111 { | 127 { |
112 canvas.width = size; | 128 canvas.width = size; |
113 canvas.height = size; | 129 canvas.height = size; |
114 context.globalAlpha = 1; | 130 context.globalAlpha = 1; |
115 context.drawImage(images[size]["base"][whitelisted | 0], 0, 0); | 131 context.drawImage(images[size]["base"][whitelisted | 0], 0, 0); |
116 context.globalAlpha = opacity; | 132 context.globalAlpha = opacity; |
117 context.drawImage(images[size]["overlay"], 0, 0); | 133 context.drawImage(images[size]["overlay"], 0, 0); |
118 imageData[size] = context.getImageData(0, 0, size, size); | 134 imageData[size] = context.getImageData(0, 0, size, size); |
119 } | 135 } |
120 frames["" + opacity + whitelisted] = imageData; | 136 frames["" + opacity + whitelisted] = imageData; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 clearInterval(interval); | 226 clearInterval(interval); |
211 resolve(); | 227 resolve(); |
212 return; | 228 return; |
213 } | 229 } |
214 | 230 |
215 animateIcon(type, frames); | 231 animateIcon(type, frames); |
216 }, 10000); | 232 }, 10000); |
217 }); | 233 }); |
218 }); | 234 }); |
219 }; | 235 }; |
OLD | NEW |