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

Side by Side Diff: background.js

Issue 6000668259123200: Remove ext.browserAction.show/hide (Closed)
Patch Set: Created Dec. 17, 2013, 3:31 p.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 | « no previous file | 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // Sets options to defaults, upgrading old options from previous versions as nec essary 76 // Sets options to defaults, upgrading old options from previous versions as nec essary
77 function setDefaultOptions() 77 function setDefaultOptions()
78 { 78 {
79 function defaultOptionValue(opt, val) 79 function defaultOptionValue(opt, val)
80 { 80 {
81 if(!(opt in localStorage)) 81 if(!(opt in localStorage))
82 localStorage[opt] = val; 82 localStorage[opt] = val;
83 } 83 }
84 84
85 defaultOptionValue("shouldShowIcon", "true");
86 defaultOptionValue("shouldShowBlockElementMenu", "true"); 85 defaultOptionValue("shouldShowBlockElementMenu", "true");
87 86
88 removeDeprecatedOptions(); 87 removeDeprecatedOptions();
89 } 88 }
90 89
91 // Upgrade options before we do anything else. 90 // Upgrade options before we do anything else.
92 setDefaultOptions(); 91 setDefaultOptions();
93 92
94 /** 93 /**
95 * Checks whether a page is whitelisted. 94 * Checks whether a page is whitelisted.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 { 126 {
128 var excluded = isWhitelisted(tab.url); 127 var excluded = isWhitelisted(tab.url);
129 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png "; 128 iconFilename = excluded ? "icons/abp-19-whitelisted.png" : "icons/abp-19.png ";
130 } 129 }
131 130
132 tab.browserAction.setIcon(iconFilename); 131 tab.browserAction.setIcon(iconFilename);
133 tab.browserAction.setTitle(ext.i18n.getMessage("name")); 132 tab.browserAction.setTitle(ext.i18n.getMessage("name"));
134 133
135 iconAnimation.registerTab(tab, iconFilename); 134 iconAnimation.registerTab(tab, iconFilename);
136 135
137 if (localStorage.shouldShowIcon == "false")
138 tab.browserAction.hide();
139 else
140 tab.browserAction.show();
141
142 if (require("info").platform == "chromium") // TODO: Implement context menus f or Safari 136 if (require("info").platform == "chromium") // TODO: Implement context menus f or Safari
143 // 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
144 if (excluded) 138 if (excluded)
145 chrome.contextMenus.removeAll(); 139 chrome.contextMenus.removeAll();
146 else 140 else
147 showContextMenu(); 141 showContextMenu();
148 } 142 }
149 143
150 /** 144 /**
151 * Old versions for Opera stored patterns.ini in the localStorage object, this 145 * Old versions for Opera stored patterns.ini in the localStorage object, this
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 tab.sendMessage({type: "clickhide-deactivate"}); 455 tab.sendMessage({type: "clickhide-deactivate"});
462 refreshIconAndContextMenu(tab); 456 refreshIconAndContextMenu(tab);
463 }); 457 });
464 458
465 setTimeout(function() 459 setTimeout(function()
466 { 460 {
467 var notificationToShow = Notification.getNextToShow(); 461 var notificationToShow = Notification.getNextToShow();
468 if (notificationToShow) 462 if (notificationToShow)
469 showNotification(notificationToShow); 463 showNotification(notificationToShow);
470 }, 3 * 60 * 1000); 464 }, 3 * 60 * 1000);
OLDNEW
« no previous file with comments | « no previous file | chrome/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld