| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script> | 3 <script> |
| 4 // Called when the user clicks on the browser action. | 4 // Called when the user clicks on the browser action. |
| 5 var clicks = 0; | 5 var clicks = 0; |
| 6 chrome.browserAction.onClicked.addListener(function() { | 6 chrome.browserAction.onClicked.addListener(function() { |
| 7 chrome.browserAction.setIcon({iconIndex:clicks}); | 7 chrome.browserAction.setIcon({iconIndex:clicks}); |
| 8 chrome.browserAction.setBadgeText({text:""+i}); |
| 8 clicks++; | 9 clicks++; |
| 9 // We only have 1 icon, but cycle through 3 icons to test the | 10 // We only have 1 icon, but cycle through 3 icons to test the |
| 10 // out-of-bounds index bug. | 11 // out-of-bounds index bug. |
| 11 if (clicks > 2) | 12 if (clicks > 2) |
| 12 clicks = 0; | 13 clicks = 0; |
| 13 }); | 14 }); |
| 14 var i = 0; | 15 var i = 0; |
| 15 | 16 |
| 16 window.setInterval(function() { | 17 window.setInterval(function() { |
| 17 // Don't animate while in "click" mode. | 18 // Don't animate while in "click" mode. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 context.fillRect((startx + 10) % 20, (starty + 10) % 20, 8, 8); | 33 context.fillRect((startx + 10) % 20, (starty + 10) % 20, 8, 8); |
| 33 return context.getImageData(0, 0, 20, 20); | 34 return context.getImageData(0, 0, 20, 20); |
| 34 } | 35 } |
| 35 </script> | 36 </script> |
| 36 </head> | 37 </head> |
| 37 <body> | 38 <body> |
| 38 <canvas id="canvas" width="20" height="20"></canvas> | 39 <canvas id="canvas" width="20" height="20"></canvas> |
| 39 </body> | 40 </body> |
| 40 </html> | 41 </html> |
| 41 | 42 |
| OLD | NEW |