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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // The tab could have been closed by the time this function is called | 116 // The tab could have been closed by the time this function is called |
117 if(!tab) | 117 if(!tab) |
118 return; | 118 return; |
119 | 119 |
120 var excluded = isWhitelisted(tab.url); | 120 var excluded = isWhitelisted(tab.url); |
121 var iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.p
ng"; | 121 var iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.p
ng"; |
122 | 122 |
123 if (activeNotification) | 123 if (activeNotification) |
124 startIconAnimation(tab, iconFilename); | 124 startIconAnimation(tab, iconFilename); |
125 else | 125 else |
126 chrome.pageAction.setIcon({tabId: tab.id, path: iconFilename}); | 126 chrome.browserAction.setIcon({tabId: tab.id, path: iconFilename}); |
127 | 127 |
128 // Only show icon for pages we can influence (http: and https:) | 128 // Only show icon for pages we can influence (http: and https:) |
129 if(/^https?:/.test(tab.url)) | 129 if(/^https?:/.test(tab.url)) |
130 { | 130 { |
131 chrome.pageAction.setTitle({tabId: tab.id, title: "Adblock Plus"}); | 131 chrome.browserAction.setTitle({tabId: tab.id, title: "Adblock Plus"}); |
132 if ("shouldShowIcon" in localStorage && localStorage["shouldShowIcon"] == "f
alse") | 132 if ("shouldShowIcon" in localStorage && localStorage["shouldShowIcon"] == "f
alse") |
133 chrome.pageAction.hide(tab.id); | 133 chrome.browserAction.hide(tab.id); |
134 else | 134 else |
135 chrome.pageAction.show(tab.id); | 135 chrome.browserAction.show(tab.id); |
136 | 136 |
137 // Set context menu status according to whether current tab has whitelisted
domain | 137 // Set context menu status according to whether current tab has whitelisted
domain |
138 if (excluded) | 138 if (excluded) |
139 chrome.contextMenus.removeAll(); | 139 chrome.contextMenus.removeAll(); |
140 else | 140 else |
141 showContextMenu(); | 141 showContextMenu(); |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 /** | 145 /** |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 | 536 |
537 function animationStep() | 537 function animationStep() |
538 { | 538 { |
539 var opacity = frameOpacities[currentFrame]; | 539 var opacity = frameOpacities[currentFrame]; |
540 context.clearRect(0, 0, canvas.width, canvas.height); | 540 context.clearRect(0, 0, canvas.width, canvas.height); |
541 context.globalAlpha = 1; | 541 context.globalAlpha = 1; |
542 context.drawImage(icon, 0, 0); | 542 context.drawImage(icon, 0, 0); |
543 context.globalAlpha = opacity; | 543 context.globalAlpha = opacity; |
544 context.drawImage(notificationIcon, 0, 0); | 544 context.drawImage(notificationIcon, 0, 0); |
545 var imageData = context.getImageData(0, 0, canvas.width, canvas.height); | 545 var imageData = context.getImageData(0, 0, canvas.width, canvas.height); |
546 chrome.pageAction.setIcon({tabId: tab.id, imageData: imageData}); | 546 chrome.browserAction.setIcon({tabId: tab.id, imageData: imageData}); |
547 | 547 |
548 var interval; | 548 var interval; |
549 currentFrame++; | 549 currentFrame++; |
550 if (currentFrame < frameOpacities.length) | 550 if (currentFrame < frameOpacities.length) |
551 { | 551 { |
552 var duration = 3000; | 552 var duration = 3000; |
553 interval = duration / frameOpacities.length; | 553 interval = duration / frameOpacities.length; |
554 } | 554 } |
555 else | 555 else |
556 { | 556 { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 tabs.forEach(refreshIconAndContextMenu); | 748 tabs.forEach(refreshIconAndContextMenu); |
749 }); | 749 }); |
750 }); | 750 }); |
751 | 751 |
752 setTimeout(function() | 752 setTimeout(function() |
753 { | 753 { |
754 var notificationToShow = Notification.getNextToShow(); | 754 var notificationToShow = Notification.getNextToShow(); |
755 if (notificationToShow) | 755 if (notificationToShow) |
756 showNotification(notificationToShow); | 756 showNotification(notificationToShow); |
757 }, 3 * 60 * 1000); | 757 }, 3 * 60 * 1000); |
OLD | NEW |