Merge branch 'fixes-168' of https://github.com/ShivangiKakkar/multi-account-containers into ShivangiKakkar-fixes-168
This commit is contained in:
commit
ea5669911b
11 changed files with 119 additions and 42 deletions
|
@ -2,13 +2,14 @@
|
|||
"name": "testpilot-containers",
|
||||
"title": "Multi-Account Containers",
|
||||
"description": "Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
|
||||
"version": "6.0.0",
|
||||
"version": "6.0.1",
|
||||
"author": "Andrea Marchesini, Luke Crouch and Jonathan Kingston",
|
||||
"bugs": {
|
||||
"url": "https://github.com/mozilla/multi-account-containers/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"ajv": "^6.6.2",
|
||||
"addons-linter": "^1.3.2",
|
||||
"chai": "^4.1.2",
|
||||
"eslint": "^3.17.1",
|
||||
|
|
|
@ -45,6 +45,7 @@ body {
|
|||
--small-text-size: 0.833rem; /* 10px */
|
||||
--small-radius: 3px;
|
||||
--icon-button-size: calc(calc(var(--block-line-separation-size) * 2) + 1.66rem); /* 20px */
|
||||
--column-panel-inline-size: 268px;
|
||||
--inactive-opacity: 0.3;
|
||||
}
|
||||
|
||||
|
@ -267,7 +268,7 @@ table {
|
|||
.column-panel-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
inline-size: 268px;
|
||||
inline-size: var(--column-panel-inline-size);
|
||||
}
|
||||
|
||||
.column-panel-content .panel-footer {
|
||||
|
@ -538,7 +539,7 @@ span ~ .panel-header-text {
|
|||
}
|
||||
|
||||
#current-tab > label > input:checked {
|
||||
background-image: url("chrome://global/skin/in-content/check.svg#check-native");
|
||||
background-image: url("/img/check.svg");
|
||||
background-position: -1px -1px;
|
||||
background-size: var(--icon-size);
|
||||
}
|
||||
|
@ -659,7 +660,11 @@ span ~ .panel-header-text {
|
|||
|
||||
/* Container info list */
|
||||
.container-info-tab-title {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.container-info-tab-row:hover .container-info-tab-title .truncate-text {
|
||||
inline-size: calc(var(--column-panel-inline-size) - 58px);
|
||||
}
|
||||
|
||||
#container-info-hideorshow {
|
||||
|
@ -676,6 +681,21 @@ span ~ .panel-header-text {
|
|||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.container-close-tab {
|
||||
transform: scale(0.7);
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
.container-info-tab-row:hover .container-close-tab {
|
||||
opacity: 0.5;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.container-info-tab-row .container-close-tab:hover {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.container-info-has-tabs,
|
||||
.container-info-tab-row {
|
||||
align-items: center;
|
||||
|
@ -702,10 +722,6 @@ span ~ .panel-header-text {
|
|||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
.container-info-tab-row td {
|
||||
max-inline-size: 200px;
|
||||
}
|
||||
|
||||
.container-info-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
8
src/img/blank-favicon.svg
Normal file
8
src/img/blank-favicon.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 61 KiB |
6
src/img/check.svg
Normal file
6
src/img/check.svg
Normal file
|
@ -0,0 +1,6 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="#3c3c3c" d="M6 14a1 1 0 0 1-.707-.293l-3-3a1 1 0 0 1 1.414-1.414l2.157 2.157 6.316-9.023a1 1 0 0 1 1.639 1.146l-7 10a1 1 0 0 1-.732.427A.863.863 0 0 1 6 14z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 477 B |
3
src/img/container-close-tab.svg
Normal file
3
src/img/container-close-tab.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7 7">
|
||||
<polygon fill="#4c4c4c" points="5.8,0 3.5,2.4 1.2,0 0,1.2 2.4,3.5 0.1,5.8 1.2,7 3.5,4.7 5.8,7 7,5.8 4.7,3.5 7,1.2"/>
|
||||
</svg>
|
After Width: | Height: | Size: 183 B |
|
@ -6,6 +6,7 @@ const backgroundLogic = {
|
|||
"about:home",
|
||||
"about:blank"
|
||||
]),
|
||||
unhideQueue: [],
|
||||
|
||||
async getExtensionInfo() {
|
||||
const manifestPath = browser.extension.getURL("manifest.json");
|
||||
|
@ -112,6 +113,17 @@ const backgroundLogic = {
|
|||
return list.concat(containerState.hiddenTabs);
|
||||
},
|
||||
|
||||
async unhideContainer(cookieStoreId) {
|
||||
if (!this.unhideQueue.includes(cookieStoreId)) {
|
||||
this.unhideQueue.push(cookieStoreId);
|
||||
await this.showTabs({
|
||||
cookieStoreId
|
||||
});
|
||||
this.unhideQueue.splice(this.unhideQueue.indexOf(cookieStoreId), 1);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
async moveTabsToWindow(options) {
|
||||
const requiredArguments = ["cookieStoreId", "windowId"];
|
||||
this.checkArgs(requiredArguments, options, "moveTabsToWindow");
|
||||
|
@ -123,6 +135,7 @@ const backgroundLogic = {
|
|||
});
|
||||
|
||||
const containerState = await identityState.storageArea.get(cookieStoreId);
|
||||
|
||||
// Nothing to do
|
||||
if (list.length === 0 &&
|
||||
containerState.hiddenTabs.length === 0) {
|
||||
|
@ -152,12 +165,15 @@ const backgroundLogic = {
|
|||
const showHiddenPromises = [];
|
||||
|
||||
// Let's show the hidden tabs.
|
||||
for (let object of containerState.hiddenTabs) { // eslint-disable-line prefer-const
|
||||
showHiddenPromises.push(browser.tabs.create({
|
||||
url: object.url || DEFAULT_TAB,
|
||||
windowId: newWindowObj.id,
|
||||
cookieStoreId
|
||||
}));
|
||||
if (!this.unhideQueue.includes(cookieStoreId)) {
|
||||
this.unhideQueue.push(cookieStoreId);
|
||||
for (let object of containerState.hiddenTabs) { // eslint-disable-line prefer-const
|
||||
showHiddenPromises.push(browser.tabs.create({
|
||||
url: object.url || DEFAULT_TAB,
|
||||
windowId: newWindowObj.id,
|
||||
cookieStoreId
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
if (hiddenDefaultTabToClose) {
|
||||
|
@ -176,7 +192,9 @@ const backgroundLogic = {
|
|||
browser.tabs.remove(tab.id);
|
||||
}
|
||||
}
|
||||
return await identityState.storageArea.set(cookieStoreId, containerState);
|
||||
const rv = await identityState.storageArea.set(cookieStoreId, containerState);
|
||||
this.unhideQueue.splice(this.unhideQueue.indexOf(cookieStoreId), 1);
|
||||
return rv;
|
||||
},
|
||||
|
||||
async _closeTabs(userContextId, windowId = false) {
|
||||
|
@ -209,7 +227,9 @@ const backgroundLogic = {
|
|||
});
|
||||
identitiesOutput[cookieStoreId] = {
|
||||
hasHiddenTabs: !!containerState.hiddenTabs.length,
|
||||
hasOpenTabs: !!openTabs.length
|
||||
hasOpenTabs: !!openTabs.length,
|
||||
numberOfHiddenTabs: containerState.hiddenTabs.length,
|
||||
numberOfOpenTabs: openTabs.length
|
||||
};
|
||||
return;
|
||||
});
|
||||
|
@ -307,4 +327,3 @@ const backgroundLogic = {
|
|||
return `firefox-container-${userContextId}`;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ const messageHandler = {
|
|||
// We use this to catch redirected tabs that have just opened
|
||||
// If this were in platform we would change how the tab opens based on "new tab" link navigations such as ctrl+click
|
||||
LAST_CREATED_TAB_TIMER: 2000,
|
||||
unhideQueue: [],
|
||||
|
||||
init() {
|
||||
// Handles messages from webextension code
|
||||
|
@ -39,7 +38,7 @@ const messageHandler = {
|
|||
backgroundLogic.sortTabs();
|
||||
break;
|
||||
case "showTabs":
|
||||
this.unhideContainer(m.cookieStoreId);
|
||||
backgroundLogic.unhideContainer(m.cookieStoreId);
|
||||
break;
|
||||
case "hideTabs":
|
||||
backgroundLogic.hideTabs({
|
||||
|
@ -156,7 +155,7 @@ const messageHandler = {
|
|||
this.incrementCountOfContainerTabsOpened();
|
||||
}
|
||||
|
||||
this.unhideContainer(tab.cookieStoreId);
|
||||
backgroundLogic.unhideContainer(tab.cookieStoreId);
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.lastCreatedTab = null;
|
||||
|
@ -182,17 +181,6 @@ const messageHandler = {
|
|||
}
|
||||
},
|
||||
|
||||
async unhideContainer(cookieStoreId) {
|
||||
if (!this.unhideQueue.includes(cookieStoreId)) {
|
||||
this.unhideQueue.push(cookieStoreId);
|
||||
// Unhide all hidden tabs
|
||||
await backgroundLogic.showTabs({
|
||||
cookieStoreId
|
||||
});
|
||||
this.unhideQueue.splice(this.unhideQueue.indexOf(cookieStoreId), 1);
|
||||
}
|
||||
},
|
||||
|
||||
async onFocusChangedCallback(windowId) {
|
||||
assignManager.removeContextMenu();
|
||||
// browserAction loses background color in new windows ...
|
||||
|
|
|
@ -162,7 +162,7 @@ const Logic = {
|
|||
async clearBrowserActionBadge() {
|
||||
const extensionInfo = await getExtensionInfo();
|
||||
const storage = await browser.storage.local.get({browserActionBadgesClicked: []});
|
||||
browser.browserAction.setBadgeBackgroundColor({color: ""});
|
||||
browser.browserAction.setBadgeBackgroundColor({color: null});
|
||||
browser.browserAction.setBadgeText({text: ""});
|
||||
storage.browserActionBadgesClicked.push(extensionInfo.version);
|
||||
// use set and spread to create a unique array
|
||||
|
@ -177,7 +177,9 @@ const Logic = {
|
|||
name: "Default",
|
||||
cookieStoreId,
|
||||
icon: "default-tab",
|
||||
color: "default-tab"
|
||||
color: "default-tab",
|
||||
numberOfHiddenTabs: 0,
|
||||
numberOfOpenTabs: 0
|
||||
};
|
||||
// Handle old style rejection with null and also Promise.reject new style
|
||||
try {
|
||||
|
@ -248,6 +250,8 @@ const Logic = {
|
|||
if (stateObject) {
|
||||
identity.hasOpenTabs = stateObject.hasOpenTabs;
|
||||
identity.hasHiddenTabs = stateObject.hasHiddenTabs;
|
||||
identity.numberOfHiddenTabs = stateObject.numberOfHiddenTabs;
|
||||
identity.numberOfOpenTabs = stateObject.numberOfOpenTabs;
|
||||
}
|
||||
return identity;
|
||||
});
|
||||
|
@ -801,20 +805,44 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
|||
tr.classList.add("container-info-tab-row");
|
||||
tr.innerHTML = escaped`
|
||||
<td></td>
|
||||
<td class="container-info-tab-title truncate-text" title="${tab.url}" >${tab.title}</td>`;
|
||||
<td class="container-info-tab-title truncate-text" title="${tab.url}" ><div class="container-tab-title">${tab.title}</div></td>`;
|
||||
tr.querySelector("td").appendChild(Utils.createFavIconElement(tab.favIconUrl));
|
||||
document.getElementById("container-info-table").appendChild(fragment);
|
||||
|
||||
// On click, we activate this tab. But only if this tab is active.
|
||||
if (!tab.hiddenState) {
|
||||
const closeImage = document.createElement("img");
|
||||
closeImage.src = "/img/container-close-tab.svg";
|
||||
closeImage.className = "container-close-tab";
|
||||
closeImage.title = "Close tab";
|
||||
closeImage.id = tab.id;
|
||||
const tabTitle = tr.querySelector(".container-info-tab-title");
|
||||
tabTitle.appendChild(closeImage);
|
||||
|
||||
// On hover, we add truncate-text class to add close-tab-image after tab title truncates
|
||||
const tabTitleHoverEvent = () => {
|
||||
tabTitle.classList.toggle("truncate-text");
|
||||
tr.querySelector(".container-tab-title").classList.toggle("truncate-text");
|
||||
};
|
||||
|
||||
tr.addEventListener("mouseover", tabTitleHoverEvent);
|
||||
tr.addEventListener("mouseout", tabTitleHoverEvent);
|
||||
|
||||
tr.classList.add("clickable");
|
||||
Logic.addEnterHandler(tr, async function () {
|
||||
await browser.tabs.update(tab.id, {active: true});
|
||||
window.close();
|
||||
});
|
||||
|
||||
const closeTab = document.getElementById(tab.id);
|
||||
if (closeTab) {
|
||||
Logic.addEnterHandler(closeTab, async function(e) {
|
||||
await browser.tabs.remove(Number(e.target.id));
|
||||
window.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("container-info-table").appendChild(fragment);
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -1074,9 +1102,17 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
|
|||
prepare() {
|
||||
const identity = Logic.currentIdentity();
|
||||
|
||||
// Populating the panel: name and icon
|
||||
// Populating the panel: name, icon, and warning message
|
||||
document.getElementById("delete-container-name").textContent = identity.name;
|
||||
|
||||
const totalNumberOfTabs = identity.numberOfHiddenTabs + identity.numberOfOpenTabs;
|
||||
let warningMessage = "";
|
||||
if (totalNumberOfTabs > 0) {
|
||||
const grammaticalNumTabs = totalNumberOfTabs > 1 ? "tabs" : "tab";
|
||||
warningMessage = `If you remove this container now, ${totalNumberOfTabs} container ${grammaticalNumTabs} will be closed.`;
|
||||
}
|
||||
document.getElementById("delete-container-tab-warning").textContent = warningMessage;
|
||||
|
||||
const icon = document.getElementById("delete-container-icon");
|
||||
icon.setAttribute("data-identity-icon", identity.icon);
|
||||
icon.setAttribute("data-identity-color", identity.color);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const DEFAULT_FAVICON = "moz-icon://goat?size=16";
|
||||
const DEFAULT_FAVICON = "/img/blank-favicon.svg";
|
||||
|
||||
// TODO use export here instead of globals
|
||||
window.Utils = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Firefox Multi-Account Containers",
|
||||
"version": "6.0.0",
|
||||
"version": "6.0.1",
|
||||
|
||||
"description": "Multi-Account Containers helps you keep all the parts of your online life contained in different tabs. Custom labels and color-coded tabs help keep different activities — like online shopping, travel planning, or checking work email — separate.",
|
||||
"icons": {
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
</div>
|
||||
<div class="panel-content delete-container-confirm">
|
||||
<h4 class="delete-container-confirm-title">Remove This Container</h4>
|
||||
<p>If you remove this container now, <span id="delete-container-tab-count"></span> container tabs will be closed. Are you sure you want to remove this Container?</p>
|
||||
<p><span id="delete-container-tab-warning"></span> Are you sure you want to remove this Container?</p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a href="#" class="button expanded secondary footer-button cancel-button" id="delete-container-cancel-link">Cancel</a>
|
||||
|
|
Loading…
Add table
Reference in a new issue