Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: background.js

Issue 29317001: Relocated icon and redesigned icon popup (Closed)
Patch Set: Created Dec. 10, 2013, 10:05 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « _locales/en_US/messages.json ('k') | chrome/background.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 var index = url.indexOf("#"); 103 var index = url.indexOf("#");
104 if (index >= 0) 104 if (index >= 0)
105 url = url.substring(0, index); 105 url = url.substring(0, index);
106 106
107 var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFro mURL(parentUrl || url), false); 107 var result = defaultMatcher.matchesAny(url, type || "DOCUMENT", extractHostFro mURL(parentUrl || url), false);
108 return (result instanceof WhitelistFilter ? result : null); 108 return (result instanceof WhitelistFilter ? result : null);
109 } 109 }
110 110
111 var activeNotification = null; 111 var activeNotification = null;
112 112
113 // Adds or removes page action icon according to options. 113 // Adds or removes browser action icon according to options.
114 function refreshIconAndContextMenu(tab) 114 function refreshIconAndContextMenu(tab)
115 { 115 {
116 if(!/^https?:/.test(tab.url)) 116 if(!/^https?:/.test(tab.url))
117 return; 117 return;
118 118
119 var iconFilename; 119 var iconFilename;
120 if (require("info").platform == "safari") 120 if (require("info").platform == "safari")
121 // There is no grayscale version of the icon for whitelisted tabs 121 // There is no grayscale version of the icon for whitelisted tabs
122 // when using Safari, because icons are grayscale already and icons 122 // when using Safari, because icons are grayscale already and icons
123 // aren't per tab in Safari. 123 // aren't per tab in Safari.
124 iconFilename = "icons/abp-16.png" 124 iconFilename = "icons/abp-16.png"
125 else 125 else
126 { 126 {
127 var excluded = isWhitelisted(tab.url); 127 var excluded = isWhitelisted(tab.url);
128 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png "; 128 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png ";
129 } 129 }
130 130
131 tab.pageAction.setIcon(iconFilename); 131 tab.browserAction.setIcon(iconFilename);
132 tab.pageAction.setTitle(ext.i18n.getMessage("name")); 132 tab.browserAction.setTitle(ext.i18n.getMessage("name"));
133 133
134 iconAnimation.registerTab(tab, iconFilename); 134 iconAnimation.registerTab(tab, iconFilename);
135 135
136 if (localStorage.shouldShowIcon == "false") 136 if (localStorage.shouldShowIcon == "false")
137 tab.pageAction.hide(); 137 tab.browserAction.hide();
138 else 138 else
139 tab.pageAction.show(); 139 tab.browserAction.show();
140 140
141 if (require("info").platform == "chromium") // TODO: Implement context menus f or Safari 141 if (require("info").platform == "chromium") // TODO: Implement context menus f or Safari
142 // Set context menu status according to whether current tab has whitelisted domain 142 // Set context menu status according to whether current tab has whitelisted domain
143 if (excluded) 143 if (excluded)
144 chrome.contextMenus.removeAll(); 144 chrome.contextMenus.removeAll();
145 else 145 else
146 showContextMenu(); 146 showContextMenu();
147 } 147 }
148 148
149 /** 149 /**
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 tab.sendMessage({type: "clickhide-deactivate"}); 597 tab.sendMessage({type: "clickhide-deactivate"});
598 refreshIconAndContextMenu(tab); 598 refreshIconAndContextMenu(tab);
599 }); 599 });
600 600
601 setTimeout(function() 601 setTimeout(function()
602 { 602 {
603 var notificationToShow = Notification.getNextToShow(); 603 var notificationToShow = Notification.getNextToShow();
604 if (notificationToShow) 604 if (notificationToShow)
605 showNotification(notificationToShow); 605 showNotification(notificationToShow);
606 }, 3 * 60 * 1000); 606 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « _locales/en_US/messages.json ('k') | chrome/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld