Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/icon.js

Issue 29350155: Issue 4353 - Fix syntax for modern Js Shell (Closed)
Patch Set: Created Aug. 24, 2016, 11:12 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 loadImage("icons/abp-32-whitelisted.png"), 98 loadImage("icons/abp-32-whitelisted.png"),
99 loadImage("icons/abp-32-notification-" + notificationType + ".png"), 99 loadImage("icons/abp-32-notification-" + notificationType + ".png"),
100 loadImage("icons/abp-38.png"), 100 loadImage("icons/abp-38.png"),
101 loadImage("icons/abp-38-whitelisted.png"), 101 loadImage("icons/abp-38-whitelisted.png"),
102 loadImage("icons/abp-38-notification-" + notificationType + ".png"), 102 loadImage("icons/abp-38-notification-" + notificationType + ".png"),
103 loadImage("icons/abp-40.png"), 103 loadImage("icons/abp-40.png"),
104 loadImage("icons/abp-40-whitelisted.png"), 104 loadImage("icons/abp-40-whitelisted.png"),
105 loadImage("icons/abp-40-notification-" + notificationType + ".png") 105 loadImage("icons/abp-40-notification-" + notificationType + ".png")
106 ]).then(images => 106 ]).then(images =>
107 { 107 {
108 let images = { 108 let imageMap = {
Sebastian Noack 2016/08/24 11:30:04 Why must this variable no longer be called "images
kzar 2016/08/24 12:24:43 Js Shell got upset since images is also the name o
109 16: { base: [images[0], images[1]], overlay: images[2] }, 109 16: { base: [images[0], images[1]], overlay: images[2] },
110 19: { 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] }, 111 20: { base: [images[6], images[7]], overlay: images[8] },
112 32: { base: [images[9], images[10]], overlay: images[11] }, 112 32: { base: [images[9], images[10]], overlay: images[11] },
113 38: { base: [images[12], images[13]], overlay: images[14] }, 113 38: { base: [images[12], images[13]], overlay: images[14] },
114 40: { base: [images[15], images[16]], overlay: images[17] } 114 40: { base: [images[15], images[16]], overlay: images[17] }
115 }; 115 };
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 let sizes = [16, 19, 20, 32, 38, 40]; 126 let sizes = [16, 19, 20, 32, 38, 40];
127 for (let size of sizes) 127 for (let size of sizes)
128 { 128 {
129 canvas.width = size; 129 canvas.width = size;
130 canvas.height = size; 130 canvas.height = size;
131 context.globalAlpha = 1; 131 context.globalAlpha = 1;
132 context.drawImage(images[size]["base"][whitelisted | 0], 0, 0); 132 context.drawImage(imageMap[size]["base"][whitelisted | 0], 0, 0);
133 context.globalAlpha = opacity; 133 context.globalAlpha = opacity;
134 context.drawImage(images[size]["overlay"], 0, 0); 134 context.drawImage(imageMap[size]["overlay"], 0, 0);
135 imageData[size] = context.getImageData(0, 0, size, size); 135 imageData[size] = context.getImageData(0, 0, size, size);
136 } 136 }
137 frames["" + opacity + whitelisted] = imageData; 137 frames["" + opacity + whitelisted] = imageData;
138 } 138 }
139 } 139 }
140 140
141 return frames; 141 return frames;
142 }); 142 });
143 } 143 }
144 144
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 clearInterval(interval); 227 clearInterval(interval);
228 resolve(); 228 resolve();
229 return; 229 return;
230 } 230 }
231 231
232 animateIcon(type, frames); 232 animateIcon(type, frames);
233 }, 10000); 233 }, 10000);
234 }); 234 });
235 }); 235 });
236 }; 236 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld