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