Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 { | 203 { |
204 this._tabId = tabId; | 204 this._tabId = tabId; |
205 }; | 205 }; |
206 BrowserAction.prototype = { | 206 BrowserAction.prototype = { |
207 setIcon: function(path) | 207 setIcon: function(path) |
208 { | 208 { |
209 var paths = {}; | 209 var paths = {}; |
210 for (var i = 1; i <= 2; i++) | 210 for (var i = 1; i <= 2; i++) |
211 { | 211 { |
212 var size = i * 19; | 212 var size = i * 19; |
213 paths[size] = path.replace(/((?:.*\/)*.+?\b)/, '$1-' + size); | 213 paths[size] = path.replace("$size", size); |
Wladimir Palant
2014/04/02 16:37:24
This is rather non-obvious behavior. It should be
Sebastian Noack
2014/04/02 17:02:08
But then we would need something like |path.replac
Wladimir Palant
2014/04/03 05:43:40
No, path.replace("$size", "16") should do, the ico
Sebastian Noack
2014/04/03 11:42:26
I somewhat agree. Here you go.
| |
214 } | 214 } |
215 | 215 |
216 chrome.browserAction.setIcon({tabId: this._tabId, path: paths}); | 216 chrome.browserAction.setIcon({tabId: this._tabId, path: paths}); |
217 }, | 217 }, |
218 setBadge: function(badge) | 218 setBadge: function(badge) |
219 { | 219 { |
220 if (!badge) | 220 if (!badge) |
221 { | 221 { |
222 chrome.browserAction.setBadgeText({ | 222 chrome.browserAction.setBadgeText({ |
223 tabId: this._tabId, | 223 tabId: this._tabId, |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 if (isContextMenuHidden) | 596 if (isContextMenuHidden) |
597 return; | 597 return; |
598 | 598 |
599 chrome.contextMenus.removeAll(); | 599 chrome.contextMenus.removeAll(); |
600 isContextMenuHidden = true; | 600 isContextMenuHidden = true; |
601 } | 601 } |
602 }; | 602 }; |
603 | 603 |
604 ext.onMessage = new BackgroundMessageEventTarget(); | 604 ext.onMessage = new BackgroundMessageEventTarget(); |
605 })(); | 605 })(); |
LEFT | RIGHT |