Skip to content

Commit 1997dc5

Browse files
koops76Hainish
authored andcommitted
Remove confusing 'inactive' caption (fixes EFForg#11823) (EFForg#11979)
1 parent b7e8be7 commit 1997dc5

File tree

7 files changed

+25
-24
lines changed

7 files changed

+25
-24
lines changed

chromium/background.js

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -160,42 +160,44 @@ function getActiveRulesetCount(id) {
160160

161161
/**
162162
* Set the icon color correctly
163-
* inactive: extension is enabled, but no rules were triggered on this page.
163+
* active: extension is enabled.
164164
* blocking: extension is in "block all HTTP requests" mode.
165-
* active: extension is enabled and rewrote URLs on this page.
166165
* disabled: extension is disabled from the popup menu.
167166
*/
168-
var updateState = function() {
169-
if (!chrome.tabs) {
170-
return;
167+
168+
function updateState () {
169+
if (!chrome.tabs) return;
170+
171+
let iconState = 'active';
172+
173+
if (!isExtensionEnabled) {
174+
iconState = 'disabled';
175+
} else if (httpNowhereOn) {
176+
iconState = 'blocking';
171177
}
178+
179+
chrome.browserAction.setIcon({
180+
path: {
181+
38: 'icons/icon-' + iconState + '-38.png'
182+
}
183+
});
184+
185+
chrome.browserAction.setTitle({
186+
title: 'HTTPS Everywhere' + (iconState === 'active') ? '' : ' (' + iconState + ')'
187+
});
188+
172189
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
173190
if (!tabs || tabs.length === 0) {
174191
return;
175192
}
193+
176194
const activeCount = getActiveRulesetCount(tabs[0].id);
177-
let iconState = "inactive";
178-
if (!isExtensionEnabled) {
179-
iconState = "disabled";
180-
} else if (httpNowhereOn) {
181-
iconState = "blocking";
182-
} else if (activeCount > 0) {
183-
iconState = "active";
184-
}
185-
chrome.browserAction.setIcon({
186-
path: {
187-
"38": "icons/icon-" + iconState + "-38.png"
188-
}
189-
});
190-
chrome.browserAction.setTitle({
191-
title: "HTTPS Everywhere (" + iconState + ")"
192-
});
193195

194-
chrome.browserAction.setBadgeBackgroundColor({ color: "#00cc00" });
196+
chrome.browserAction.setBadgeBackgroundColor({ color: '#00cc00' });
195197

196198
const showBadge = activeCount > 0 && isExtensionEnabled && showCounter;
197199

198-
chrome.browserAction.setBadgeText({ text: showBadge ? String(activeCount) : "" });
200+
chrome.browserAction.setBadgeText({ text: showBadge ? String(activeCount) : '' });
199201
});
200202
}
201203

chromium/icons/icon-inactive-38.png

Lines changed: 0 additions & 1 deletion
This file was deleted.

common/icons/icon-inactive-128.png

-888 Bytes
Binary file not shown.

common/icons/icon-inactive-16.png

-275 Bytes
Binary file not shown.

common/icons/icon-inactive-24.png

-346 Bytes
Binary file not shown.

common/icons/icon-inactive-38.png

-806 Bytes
Binary file not shown.

common/icons/icon-inactive-48.png

-487 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)