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 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 if(!/^https?:/.test(tab.url)) | 106 var whitelisted = isWhitelisted(tab.url); |
107 return; | |
108 | 107 |
109 var iconFilename; | 108 var iconFilename; |
110 if (require("info").platform == "safari") | 109 if (require("info").platform == "safari") |
111 // There is no grayscale version of the icon for whitelisted tabs | 110 // There is no grayscale version of the icon for whitelisted tabs |
112 // when using Safari, because icons are grayscale already and icons | 111 // when using Safari, because icons are grayscale already and icons |
113 // aren't per tab in Safari. | 112 // aren't per tab in Safari. |
114 iconFilename = "icons/abp-16.png" | 113 iconFilename = "icons/abp-16.png" |
115 else | 114 else |
116 { | 115 iconFilename = whitelisted ? "icons/abp-19-whitelisted.png" : "icons/abp-19.
png"; |
117 var excluded = isWhitelisted(tab.url); | |
118 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png
"; | |
119 } | |
120 | 116 |
121 tab.browserAction.setIcon(iconFilename); | 117 tab.browserAction.setIcon(iconFilename); |
122 iconAnimation.registerTab(tab, iconFilename); | 118 iconAnimation.registerTab(tab, iconFilename); |
123 | 119 |
124 // 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 |
125 if (excluded) | 121 if (whitelisted || !/^https?:/.test(tab.url)) |
126 ext.contextMenus.hideMenuItems(); | 122 ext.contextMenus.hideMenuItems(); |
127 else | 123 else |
128 ext.contextMenus.showMenuItems(); | 124 ext.contextMenus.showMenuItems(); |
129 } | 125 } |
130 | 126 |
131 /** | 127 /** |
132 * 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 |
133 * will import it into FilterStorage properly. | 129 * will import it into FilterStorage properly. |
134 * @return {Boolean} true if data import is in progress | 130 * @return {Boolean} true if data import is in progress |
135 */ | 131 */ |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 tab.sendMessage({type: "clickhide-deactivate"}); | 419 tab.sendMessage({type: "clickhide-deactivate"}); |
424 refreshIconAndContextMenu(tab); | 420 refreshIconAndContextMenu(tab); |
425 }); | 421 }); |
426 | 422 |
427 setTimeout(function() | 423 setTimeout(function() |
428 { | 424 { |
429 var notificationToShow = Notification.getNextToShow(); | 425 var notificationToShow = Notification.getNextToShow(); |
430 if (notificationToShow) | 426 if (notificationToShow) |
431 showNotification(notificationToShow); | 427 showNotification(notificationToShow); |
432 }, 3 * 60 * 1000); | 428 }, 3 * 60 * 1000); |
OLD | NEW |