| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // when using Safari, because icons are grayscale already and icons | 110 // when using Safari, because icons are grayscale already and icons |
| 111 // aren't per tab in Safari. | 111 // aren't per tab in Safari. |
| 112 iconFilename = "icons/abp-16.png" | 112 iconFilename = "icons/abp-16.png" |
| 113 else | 113 else |
| 114 { | 114 { |
| 115 var excluded = isWhitelisted(tab.url); | 115 var excluded = isWhitelisted(tab.url); |
| 116 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png "; | 116 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png "; |
| 117 } | 117 } |
| 118 | 118 |
| 119 tab.browserAction.setIcon(iconFilename); | 119 tab.browserAction.setIcon(iconFilename); |
| 120 tab.browserAction.setTitle(ext.i18n.getMessage("name")); | |
| 121 | |
| 122 iconAnimation.registerTab(tab, iconFilename); | 120 iconAnimation.registerTab(tab, iconFilename); |
| 123 | 121 |
| 124 // Set context menu status according to whether current tab has whitelisted do main | 122 // Set context menu status according to whether current tab has whitelisted do main |
| 125 if (excluded) | 123 if (excluded) |
| 126 chrome.contextMenus.removeAll(); | 124 chrome.contextMenus.removeAll(); |
| 127 else | 125 else |
| 128 showContextMenu(); | 126 showContextMenu(); |
| 129 } | 127 } |
| 130 | 128 |
| 131 /** | 129 /** |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 // sendResponse asynchronously | 402 // sendResponse asynchronously |
| 405 return true; | 403 return true; |
| 406 } | 404 } |
| 407 break; | 405 break; |
| 408 default: | 406 default: |
| 409 sendResponse({}); | 407 sendResponse({}); |
| 410 break; | 408 break; |
| 411 } | 409 } |
| 412 }); | 410 }); |
| 413 | 411 |
| 412 // Set icon title/tooltip globally | |
| 413 ext.browserAction.setTitle(ext.i18n.getMessage("name")); | |
|
Wladimir Palant
2014/01/16 09:10:05
If you take this route then there should also be a
Sebastian Noack
2014/01/16 12:45:02
I think it is fine as it is. the default icon is a
Wladimir Palant
2014/01/16 12:55:18
The difference however is: Chrome will reset the i
Sebastian Noack
2014/01/16 14:01:52
Yes, but we backup the default (which comes from I
Wladimir Palant
2014/01/17 07:54:36
Ok, I see - setting the image explicitly is indeed
| |
| 414 | |
| 414 // Show icon as browser action for all tabs that already exist | 415 // Show icon as browser action for all tabs that already exist |
| 415 ext.windows.getAll(function(windows) | 416 ext.windows.getAll(function(windows) |
| 416 { | 417 { |
| 417 for (var i = 0; i < windows.length; i++) | 418 for (var i = 0; i < windows.length; i++) |
| 418 { | 419 { |
| 419 windows[i].getAllTabs(function(tabs) | 420 windows[i].getAllTabs(function(tabs) |
| 420 { | 421 { |
| 421 tabs.forEach(refreshIconAndContextMenu); | 422 tabs.forEach(refreshIconAndContextMenu); |
| 422 }); | 423 }); |
| 423 } | 424 } |
| 424 }); | 425 }); |
| 425 | 426 |
| 426 // Update icon if a tab changes location | 427 // Update icon if a tab changes location |
| 427 ext.tabs.onLoading.addListener(function(tab) | 428 ext.tabs.onLoading.addListener(function(tab) |
| 428 { | 429 { |
| 429 tab.sendMessage({type: "clickhide-deactivate"}); | 430 tab.sendMessage({type: "clickhide-deactivate"}); |
| 430 refreshIconAndContextMenu(tab); | 431 refreshIconAndContextMenu(tab); |
| 431 }); | 432 }); |
| 432 | 433 |
| 433 setTimeout(function() | 434 setTimeout(function() |
| 434 { | 435 { |
| 435 var notificationToShow = Notification.getNextToShow(); | 436 var notificationToShow = Notification.getNextToShow(); |
| 436 if (notificationToShow) | 437 if (notificationToShow) |
| 437 showNotification(notificationToShow); | 438 showNotification(notificationToShow); |
| 438 }, 3 * 60 * 1000); | 439 }, 3 * 60 * 1000); |
| OLD | NEW |