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-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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 // Remove deprecated options before we do anything else. | 98 // Remove deprecated options before we do anything else. |
99 removeDeprecatedOptions(); | 99 removeDeprecatedOptions(); |
100 | 100 |
101 var activeNotification = null; | 101 var activeNotification = null; |
102 | 102 |
103 // Adds or removes browser action icon according to options. | 103 // Adds or removes browser action icon according to options. |
104 function refreshIconAndContextMenu(tab) | 104 function refreshIconAndContextMenu(tab) |
105 { | 105 { |
| 106 var whitelisted = isWhitelisted(tab.url); |
| 107 |
106 var iconFilename; | 108 var iconFilename; |
107 if (require("info").platform == "safari") | 109 if (require("info").platform == "safari") |
108 // There is no grayscale version of the icon for whitelisted tabs | 110 // There is no grayscale version of the icon for whitelisted tabs |
109 // when using Safari, because icons are grayscale already and icons | 111 // when using Safari, because icons are grayscale already and icons |
110 // aren't per tab in Safari. | 112 // aren't per tab in Safari. |
111 iconFilename = "icons/abp-16.png" | 113 iconFilename = "icons/abp-16.png" |
112 else | 114 else |
113 { | 115 iconFilename = whitelisted ? "icons/abp-19-whitelisted.png" : "icons/abp-19.
png"; |
114 var excluded = isWhitelisted(tab.url); | |
115 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png
"; | |
116 } | |
117 | 116 |
118 tab.browserAction.setIcon(iconFilename); | 117 tab.browserAction.setIcon(iconFilename); |
119 iconAnimation.registerTab(tab, iconFilename); | 118 iconAnimation.registerTab(tab, iconFilename); |
120 | 119 |
121 // Set context menu status according to whether current tab has whitelisted do
main | 120 // Set context menu status according to whether current tab has whitelisted do
main |
122 if (excluded) | 121 if (whitelisted || !/^https?:/.test(tab.url)) |
123 ext.contextMenus.hideMenuItems(); | 122 ext.contextMenus.hideMenuItems(); |
124 else | 123 else |
125 ext.contextMenus.showMenuItems(); | 124 ext.contextMenus.showMenuItems(); |
126 } | 125 } |
127 | 126 |
128 /** | 127 /** |
129 * Old versions for Opera stored patterns.ini in the localStorage object, this | 128 * Old versions for Opera stored patterns.ini in the localStorage object, this |
130 * will import it into FilterStorage properly. | 129 * will import it into FilterStorage properly. |
131 * @return {Boolean} true if data import is in progress | 130 * @return {Boolean} true if data import is in progress |
132 */ | 131 */ |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 tab.sendMessage({type: "clickhide-deactivate"}); | 419 tab.sendMessage({type: "clickhide-deactivate"}); |
421 refreshIconAndContextMenu(tab); | 420 refreshIconAndContextMenu(tab); |
422 }); | 421 }); |
423 | 422 |
424 setTimeout(function() | 423 setTimeout(function() |
425 { | 424 { |
426 var notificationToShow = Notification.getNextToShow(); | 425 var notificationToShow = Notification.getNextToShow(); |
427 if (notificationToShow) | 426 if (notificationToShow) |
428 showNotification(notificationToShow); | 427 showNotification(notificationToShow); |
429 }, 3 * 60 * 1000); | 428 }, 3 * 60 * 1000); |
LEFT | RIGHT |