Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50f5ebfcff | |||
| 0b760ce465 | |||
| bedebb7c0e | |||
| 9447792e53 | |||
| 8512794b43 | |||
| 081ea0bedb | |||
| d2c00a10cf | |||
| 56b85a8cdd | |||
| 4e4ed390e0 | |||
| 86edd8c8a2 | |||
| 4b56a2f0bb | |||
| 66be5e288d | |||
| 7ebed4521d | |||
| 68b1b2fe37 | |||
| 89719f7243 | |||
| 4d76c937fe | |||
| 649110ed45 | |||
| f4bcd30434 | |||
| c2ff3f00f2 | |||
| 6494b98157 | |||
| c371cd11d0 | |||
| 1b22753811 | |||
| e7af96b625 | |||
| 0c04b83207 | |||
| 6b73cee79e | |||
| d7688cb1f5 | |||
| c03df9d246 | |||
| a1d01f8ff2 | |||
| f0afc0da36 | |||
| fc070b2d0d | |||
| 899476e81a | |||
| 518f1cca89 | |||
| 997fe4db12 | |||
| a5f6f8381a | |||
| 46d76dfaa3 | |||
| 00a1ce9dca | |||
| b6f3c15999 | |||
| 024fb03c33 | |||
| 9c80781e3f | |||
| 2ed9eaee8a | |||
| c03c3c118c | |||
| 4bd412aa9b |
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
The Firefox Multi-Account Containers extension lets you carve out a separate box for each of your online lives – no more opening a different browser just to check your work email! [Learn More Here](https://blog.mozilla.org/firefox/introducing-firefox-multi-account-containers/)
|
The Firefox Multi-Account Containers extension lets you carve out a separate box for each of your online lives – no more opening a different browser just to check your work email! [Learn More Here](https://blog.mozilla.org/firefox/introducing-firefox-multi-account-containers/)
|
||||||
|
|
||||||
[Available on addons.mozilla.org](https://addons.mozilla.org/en-GB/firefox/addon/multi-account-containers/)
|
[Available on addons.mozilla.org](https://addons.mozilla.org/firefox/addon/multi-account-containers/)
|
||||||
|
|
||||||
For more info, see:
|
For more info, see:
|
||||||
|
|
||||||
@@ -18,17 +18,43 @@ For more info, see:
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
1. `npm install`
|
### Running Locally
|
||||||
2. `./node_modules/web-ext/bin/web-ext run -s src/`
|
|
||||||
|
#### Via WebExtensions API (web-ext)
|
||||||
|
|
||||||
|
1. Install the [web-ext](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext) tool.
|
||||||
|
2. Run `web-ext run -s src/`. This launches Firefox and installs the extension automatically.
|
||||||
|
|
||||||
|
This tool provides some additional development features, such as [automatic reloading](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Getting_started_with_web-ext#Automatic_extension_reloading).
|
||||||
|
|
||||||
|
#### Via about:debugging in Firefox
|
||||||
|
|
||||||
|
1. Open the `about:debugging` page in Firefox.
|
||||||
|
2. Click on `This Firefox`.
|
||||||
|
3. Click on [Load Temporary Add-on](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Temporary_Installation_in_Firefox).
|
||||||
|
4. Select `src/manifest.json`.
|
||||||
|
|
||||||
|
Here is a [video](https://www.youtube.com/watch?v=cer9EUKegG4) that demonstrates how to do this.
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
`npm run test`
|
|
||||||
|
|
||||||
or
|
* Install dependencies:
|
||||||
|
|
||||||
`npm run lint`
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
for just the linter
|
* Run all tests:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
|
|
||||||
|
* Only run the linter:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
There is a timeout test that sometimes fails on certain machines, so make sure to run the tests on your clone before you make any changes to see if you have this problem.
|
There is a timeout test that sometimes fails on certain machines, so make sure to run the tests on your clone before you make any changes to see if you have this problem.
|
||||||
|
|
||||||
@@ -43,12 +69,12 @@ There is a timeout test that sometimes fails on certain machines, so make sure t
|
|||||||
#### Publish to AMO
|
#### Publish to AMO
|
||||||
|
|
||||||
1. `npm run-script build`
|
1. `npm run-script build`
|
||||||
2. [Upload the `.zip` to AMO](https://addons.mozilla.org/en-US/developers/addon/multi-account-containers/versions/submit/)
|
2. [Upload the `.zip` to AMO](https://addons.mozilla.org/developers/addon/multi-account-containers/versions/submit/)
|
||||||
|
|
||||||
#### Publish to GitHub
|
#### Publish to GitHub
|
||||||
Finally, we also publish the release to GitHub for those followers.
|
Finally, we also publish the release to GitHub for those followers.
|
||||||
|
|
||||||
1. Download the signed `.xpi` from [the addon versions page](https://addons.mozilla.org/en-US/developers/addon/multi-account-containers/versions)
|
1. Download the signed `.xpi` from [the addon versions page](https://addons.mozilla.org/developers/addon/multi-account-containers/versions)
|
||||||
2. [Make the new release on
|
2. [Make the new release on
|
||||||
GitHub](https://github.com/mozilla/multi-account-containers/releases/new)
|
GitHub](https://github.com/mozilla/multi-account-containers/releases/new)
|
||||||
* Use the version number for "Tag version" and "Release title"
|
* Use the version number for "Tag version" and "Release title"
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
"name": "testpilot-containers",
|
"name": "testpilot-containers",
|
||||||
"title": "Multi-Account 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.",
|
"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": "7.0.1",
|
"version": "7.4.0",
|
||||||
"author": "Andrea Marchesini, Luke Crouch and Jonathan Kingston",
|
"author": "Andrea Marchesini, Luke Crouch and Jonathan Kingston",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/mozilla/multi-account-containers/issues"
|
"url": "https://github.com/mozilla/multi-account-containers/issues"
|
||||||
@@ -22,10 +22,10 @@
|
|||||||
"nyc": "^15.0.0",
|
"nyc": "^15.0.0",
|
||||||
"sinon": "^7.5.0",
|
"sinon": "^7.5.0",
|
||||||
"sinon-chai": "^3.3.0",
|
"sinon-chai": "^3.3.0",
|
||||||
"stylelint-order": "^4.0.0",
|
|
||||||
"stylelint": "^13.5.0",
|
"stylelint": "^13.5.0",
|
||||||
"stylelint-config-standard": "^20.0.0",
|
"stylelint-config-standard": "^20.0.0",
|
||||||
"web-ext": "^2.9.3",
|
"stylelint-order": "^4.0.0",
|
||||||
|
"web-ext": "^5.4.1",
|
||||||
"webextensions-jsdom": "^1.2.1"
|
"webextensions-jsdom": "^1.2.1"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/mozilla/multi-account-containers#readme",
|
"homepage": "https://github.com/mozilla/multi-account-containers#readme",
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ main {
|
|||||||
button .container-name,
|
button .container-name,
|
||||||
#current-container-name {
|
#current-container-name {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 1300px) {
|
@media only screen and (max-width: 1300px) {
|
||||||
@@ -28,7 +27,7 @@ button .container-name,
|
|||||||
|
|
||||||
/* for a mid sized window we have enough for this but not our image */
|
/* for a mid sized window we have enough for this but not our image */
|
||||||
.title {
|
.title {
|
||||||
background-image: url("chrome://global/skin/icons/info.svg");
|
background-image: url('chrome://global/skin/icons/info.svg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +76,11 @@ dfn {
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#deny,
|
||||||
|
#confirm {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.button-container > button {
|
.button-container > button {
|
||||||
min-inline-size: 240px;
|
min-inline-size: 240px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -691,6 +691,10 @@ h3.title {
|
|||||||
max-inline-size: 300px;
|
max-inline-size: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-item.drag-over td {
|
||||||
|
border-block-start: 2px solid var(--text-normal-color);
|
||||||
|
}
|
||||||
|
|
||||||
.disabled-menu-item {
|
.disabled-menu-item {
|
||||||
color: grey;
|
color: grey;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
@@ -931,3 +935,115 @@ tr > td > .trash-button {
|
|||||||
tr:hover > td > .trash-button {
|
tr:hover > td > .trash-button {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.move-button {
|
||||||
|
cursor: move;
|
||||||
|
display: inline-block;
|
||||||
|
height: 100%;
|
||||||
|
inline-size: 16px;
|
||||||
|
margin-block-end: 4px;
|
||||||
|
margin-block-start: 4px;
|
||||||
|
margin-inline-end: 10px;
|
||||||
|
margin-inline-start: auto;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.move-button > img {
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--title-text-color: #fff;
|
||||||
|
--text-normal-color: #f9f9fa;
|
||||||
|
--text-heading-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
background-color: #4a4a4a;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
--hr-grey: #38383d;
|
||||||
|
--text-grey: #f9f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3.title {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-btn {
|
||||||
|
background-color: #737373;
|
||||||
|
border: solid 1px #737373;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-return.arrow-left {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.onboarding-title,
|
||||||
|
.delete-container-confirm-title {
|
||||||
|
color: #ededf0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
border: solid 1px #737373;
|
||||||
|
}
|
||||||
|
|
||||||
|
#edit-container-panel-name-input {
|
||||||
|
background-color: #38383d;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-container {
|
||||||
|
background-color: #4a4a4a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
background-color: #737373;
|
||||||
|
color: #f9f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-button,
|
||||||
|
.grey-button {
|
||||||
|
background-color: #737373;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button.secondary:hover,
|
||||||
|
.button.secondary:focus {
|
||||||
|
background-color: #676767;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-footer {
|
||||||
|
border-block-end: solid 1px #4a4a4a;
|
||||||
|
}
|
||||||
|
|
||||||
|
img.menu-icon,
|
||||||
|
.menu-icon > img,
|
||||||
|
.menu-arrow > img,
|
||||||
|
.info-icon > img,
|
||||||
|
.btn-return.arrow-left {
|
||||||
|
filter: invert(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#edit-sites-assigned .menu-icon,
|
||||||
|
#container-info-table .menu-icon {
|
||||||
|
filter: invert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.truncate-text::after {
|
||||||
|
background: #4a4a4a;
|
||||||
|
mask-image: linear-gradient(to right, transparent, #4a4a4a 70%);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-identity-color="grey"] {
|
||||||
|
--identity-icon-color: #ededf0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type="radio"]:checked + [data-identity-color="grey"] {
|
||||||
|
--identity-icon-color: #616161;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><script xmlns=""/>
|
||||||
|
<defs/>
|
||||||
|
<g id="All" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||||
|
<g id="hamburger-menu" fill="#858585">
|
||||||
|
<g id="Group" transform="translate(2.000000, 6.000000)">
|
||||||
|
<rect id="Rectangle-path" x="0" y="0" width="26" height="2"/>
|
||||||
|
<rect id="Rectangle-path" x="0" y="8" width="26" height="2"/>
|
||||||
|
<rect id="Rectangle-path" x="0" y="16" width="26" height="2"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 706 B |
@@ -51,6 +51,11 @@ window.assignManager = {
|
|||||||
return !!syncEnabled;
|
return !!syncEnabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async getReplaceTabEnabled() {
|
||||||
|
const { replaceTabEnabled } = await browser.storage.local.get("replaceTabEnabled");
|
||||||
|
return !!replaceTabEnabled;
|
||||||
|
},
|
||||||
|
|
||||||
getByUrlKey(siteStoreKey) {
|
getByUrlKey(siteStoreKey) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.area.get([siteStoreKey]).then((storageResponse) => {
|
this.area.get([siteStoreKey]).then((storageResponse) => {
|
||||||
@@ -233,9 +238,11 @@ window.assignManager = {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const replaceTabEnabled = await this.storageArea.getReplaceTabEnabled();
|
||||||
const removeTab = backgroundLogic.NEW_TAB_PAGES.has(tab.url)
|
const removeTab = backgroundLogic.NEW_TAB_PAGES.has(tab.url)
|
||||||
|| (messageHandler.lastCreatedTab
|
|| (messageHandler.lastCreatedTab
|
||||||
&& messageHandler.lastCreatedTab.id === tab.id);
|
&& messageHandler.lastCreatedTab.id === tab.id)
|
||||||
|
|| replaceTabEnabled;
|
||||||
const openTabId = removeTab ? tab.openerTabId : tab.id;
|
const openTabId = removeTab ? tab.openerTabId : tab.id;
|
||||||
|
|
||||||
if (!this.canceledRequests[tab.id]) {
|
if (!this.canceledRequests[tab.id]) {
|
||||||
@@ -691,7 +698,7 @@ window.assignManager = {
|
|||||||
|
|
||||||
reloadPageInContainer(url, currentUserContextId, userContextId, index, active, neverAsk = false, openerTabId = null) {
|
reloadPageInContainer(url, currentUserContextId, userContextId, index, active, neverAsk = false, openerTabId = null) {
|
||||||
const cookieStoreId = backgroundLogic.cookieStoreId(userContextId);
|
const cookieStoreId = backgroundLogic.cookieStoreId(userContextId);
|
||||||
const loadPage = browser.extension.getURL("confirm-page.html");
|
const loadPage = browser.runtime.getURL("confirm-page.html");
|
||||||
// False represents assignment is not permitted
|
// False represents assignment is not permitted
|
||||||
// If the user has explicitly checked "Never Ask Again" on the warning page we will send them straight there
|
// If the user has explicitly checked "Never Ask Again" on the warning page we will send them straight there
|
||||||
if (neverAsk) {
|
if (neverAsk) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const backgroundLogic = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async getExtensionInfo() {
|
async getExtensionInfo() {
|
||||||
const manifestPath = browser.extension.getURL("manifest.json");
|
const manifestPath = browser.runtime.getURL("manifest.json");
|
||||||
const response = await fetch(manifestPath);
|
const response = await fetch(manifestPath);
|
||||||
const extensionInfo = await response.json();
|
const extensionInfo = await response.json();
|
||||||
return extensionInfo;
|
return extensionInfo;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ async function addMessage(message) {
|
|||||||
divElement.innerText = message.text;
|
divElement.innerText = message.text;
|
||||||
|
|
||||||
const imageElement = document.createElement("img");
|
const imageElement = document.createElement("img");
|
||||||
const imagePath = browser.extension.getURL("/img/container-site-d-24.png");
|
const imagePath = browser.runtime.getURL("/img/container-site-d-24.png");
|
||||||
const response = await fetch(imagePath);
|
const response = await fetch(imagePath);
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
const objectUrl = URL.createObjectURL(blob);
|
const objectUrl = URL.createObjectURL(blob);
|
||||||
|
|||||||
+10
-10
@@ -16,25 +16,24 @@ async function requestPermissions() {
|
|||||||
|
|
||||||
async function enableDisableSync() {
|
async function enableDisableSync() {
|
||||||
const checkbox = document.querySelector("#syncCheck");
|
const checkbox = document.querySelector("#syncCheck");
|
||||||
if (checkbox.checked) {
|
await browser.storage.local.set({syncEnabled: !!checkbox.checked});
|
||||||
await browser.storage.local.set({syncEnabled: true});
|
|
||||||
} else {
|
|
||||||
await browser.storage.local.set({syncEnabled: false});
|
|
||||||
}
|
|
||||||
browser.runtime.sendMessage({ method: "resetSync" });
|
browser.runtime.sendMessage({ method: "resetSync" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function enableDisableReplaceTab() {
|
||||||
|
const checkbox = document.querySelector("#replaceTabCheck");
|
||||||
|
await browser.storage.local.set({replaceTabEnabled: !!checkbox.checked});
|
||||||
|
}
|
||||||
|
|
||||||
async function setupOptions() {
|
async function setupOptions() {
|
||||||
const hasPermission = await browser.permissions.contains({permissions: ["bookmarks"]});
|
const hasPermission = await browser.permissions.contains({permissions: ["bookmarks"]});
|
||||||
const { syncEnabled } = await browser.storage.local.get("syncEnabled");
|
const { syncEnabled } = await browser.storage.local.get("syncEnabled");
|
||||||
|
const { replaceTabEnabled } = await browser.storage.local.get("replaceTabEnabled");
|
||||||
if (hasPermission) {
|
if (hasPermission) {
|
||||||
document.querySelector("#bookmarksPermissions").checked = true;
|
document.querySelector("#bookmarksPermissions").checked = true;
|
||||||
}
|
}
|
||||||
if (syncEnabled) {
|
document.querySelector("#syncCheck").checked = !!syncEnabled;
|
||||||
document.querySelector("#syncCheck").checked = true;
|
document.querySelector("#replaceTabCheck").checked = !!replaceTabEnabled;
|
||||||
} else {
|
|
||||||
document.querySelector("#syncCheck").checked = false;
|
|
||||||
}
|
|
||||||
setupContainerShortcutSelects();
|
setupContainerShortcutSelects();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +81,7 @@ function resetOnboarding() {
|
|||||||
document.addEventListener("DOMContentLoaded", setupOptions);
|
document.addEventListener("DOMContentLoaded", setupOptions);
|
||||||
document.querySelector("#bookmarksPermissions").addEventListener( "change", requestPermissions);
|
document.querySelector("#bookmarksPermissions").addEventListener( "change", requestPermissions);
|
||||||
document.querySelector("#syncCheck").addEventListener( "change", enableDisableSync);
|
document.querySelector("#syncCheck").addEventListener( "change", enableDisableSync);
|
||||||
|
document.querySelector("#replaceTabCheck").addEventListener( "change", enableDisableReplaceTab);
|
||||||
document.querySelector("button").addEventListener("click", resetOnboarding);
|
document.querySelector("button").addEventListener("click", resetOnboarding);
|
||||||
|
|
||||||
for (let i=0; i < NUMBER_OF_KEYBOARD_SHORTCUTS; i++) {
|
for (let i=0; i < NUMBER_OF_KEYBOARD_SHORTCUTS; i++) {
|
||||||
|
|||||||
+96
-25
@@ -10,6 +10,8 @@ const DEFAULT_ICON = "circle";
|
|||||||
const NEW_CONTAINER_ID = "new";
|
const NEW_CONTAINER_ID = "new";
|
||||||
|
|
||||||
const ONBOARDING_STORAGE_KEY = "onboarding-stage";
|
const ONBOARDING_STORAGE_KEY = "onboarding-stage";
|
||||||
|
const CONTAINER_ORDER_STORAGE_KEY = "container-order";
|
||||||
|
const CONTAINER_DRAG_DATA_TYPE = "firefox-container";
|
||||||
|
|
||||||
// List of panels
|
// List of panels
|
||||||
const P_ONBOARDING_1 = "onboarding1";
|
const P_ONBOARDING_1 = "onboarding1";
|
||||||
@@ -30,9 +32,16 @@ const P_CONTAINER_DELETE = "containerDelete";
|
|||||||
const P_CONTAINERS_ACHIEVEMENT = "containersAchievement";
|
const P_CONTAINERS_ACHIEVEMENT = "containersAchievement";
|
||||||
const P_CONTAINER_ASSIGNMENTS = "containerAssignments";
|
const P_CONTAINER_ASSIGNMENTS = "containerAssignments";
|
||||||
|
|
||||||
|
function addRemoveSiteIsolation() {
|
||||||
|
const identity = Logic.currentIdentity();
|
||||||
|
browser.runtime.sendMessage({
|
||||||
|
method: "addRemoveSiteIsolation",
|
||||||
|
cookieStoreId: identity.cookieStoreId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function getExtensionInfo() {
|
async function getExtensionInfo() {
|
||||||
const manifestPath = browser.extension.getURL("manifest.json");
|
const manifestPath = browser.runtime.getURL("manifest.json");
|
||||||
const response = await fetch(manifestPath);
|
const response = await fetch(manifestPath);
|
||||||
const extensionInfo = await response.json();
|
const extensionInfo = await response.json();
|
||||||
return extensionInfo;
|
return extensionInfo;
|
||||||
@@ -185,16 +194,29 @@ const Logic = {
|
|||||||
elementToEnable.classList.remove("disabled-menu-item");
|
elementToEnable.classList.remove("disabled-menu-item");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async saveContainerOrder(rows) {
|
||||||
|
const containerOrder = {};
|
||||||
|
rows.forEach((node, index) => {
|
||||||
|
return containerOrder[node.dataset.containerId] = index;
|
||||||
|
});
|
||||||
|
await browser.storage.local.set({
|
||||||
|
[CONTAINER_ORDER_STORAGE_KEY]: containerOrder
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
async refreshIdentities() {
|
async refreshIdentities() {
|
||||||
const [identities, state] = await Promise.all([
|
const [identities, state, containerOrderStorage] = await Promise.all([
|
||||||
browser.contextualIdentities.query({}),
|
browser.contextualIdentities.query({}),
|
||||||
browser.runtime.sendMessage({
|
browser.runtime.sendMessage({
|
||||||
method: "queryIdentitiesState",
|
method: "queryIdentitiesState",
|
||||||
message: {
|
message: {
|
||||||
windowId: browser.windows.WINDOW_ID_CURRENT
|
windowId: browser.windows.WINDOW_ID_CURRENT
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
|
browser.storage.local.get([CONTAINER_ORDER_STORAGE_KEY])
|
||||||
]);
|
]);
|
||||||
|
const containerOrder =
|
||||||
|
containerOrderStorage && containerOrderStorage[CONTAINER_ORDER_STORAGE_KEY];
|
||||||
this._identities = identities.map((identity) => {
|
this._identities = identities.map((identity) => {
|
||||||
const stateObject = state[identity.cookieStoreId];
|
const stateObject = state[identity.cookieStoreId];
|
||||||
if (stateObject) {
|
if (stateObject) {
|
||||||
@@ -204,8 +226,11 @@ const Logic = {
|
|||||||
identity.numberOfOpenTabs = stateObject.numberOfOpenTabs;
|
identity.numberOfOpenTabs = stateObject.numberOfOpenTabs;
|
||||||
identity.isIsolated = stateObject.isIsolated;
|
identity.isIsolated = stateObject.isIsolated;
|
||||||
}
|
}
|
||||||
|
if (containerOrder) {
|
||||||
|
identity.order = containerOrder[identity.cookieStoreId];
|
||||||
|
}
|
||||||
return identity;
|
return identity;
|
||||||
});
|
}).sort((i1, i2) => i1.order - i2.order);
|
||||||
},
|
},
|
||||||
|
|
||||||
getPanelSelector(panel) {
|
getPanelSelector(panel) {
|
||||||
@@ -778,8 +803,8 @@ Logic.registerPanel(P_CONTAINER_INFO, {
|
|||||||
});
|
});
|
||||||
// Populating the panel: name and icon
|
// Populating the panel: name and icon
|
||||||
document.getElementById("container-info-title").textContent = identity.name;
|
document.getElementById("container-info-title").textContent = identity.name;
|
||||||
|
|
||||||
const alwaysOpen = document.querySelector("#always-open-in-info-panel");
|
const alwaysOpen = document.querySelector("#always-open-in-info-panel");
|
||||||
Utils.addEnterHandler(alwaysOpen, async () => {
|
Utils.addEnterHandler(alwaysOpen, async () => {
|
||||||
Utils.alwaysOpenInContainer(identity);
|
Utils.alwaysOpenInContainer(identity);
|
||||||
window.close();
|
window.close();
|
||||||
@@ -916,7 +941,7 @@ Logic.registerPanel(OPEN_NEW_CONTAINER_PICKER, {
|
|||||||
tr.setAttribute("tabindex", "0");
|
tr.setAttribute("tabindex", "0");
|
||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
|
|
||||||
td.innerHTML = Utils.escaped`
|
td.innerHTML = Utils.escaped`
|
||||||
<div class="menu-icon">
|
<div class="menu-icon">
|
||||||
<div class="usercontext-icon"
|
<div class="usercontext-icon"
|
||||||
data-identity-icon="${identity.icon}"
|
data-identity-icon="${identity.icon}"
|
||||||
@@ -992,19 +1017,66 @@ Logic.registerPanel(MANAGE_CONTAINERS_PICKER, {
|
|||||||
tr.setAttribute("tabindex", "0");
|
tr.setAttribute("tabindex", "0");
|
||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
|
|
||||||
td.innerHTML = Utils.escaped`
|
td.innerHTML = Utils.escaped`
|
||||||
<div class="menu-icon hover-highlight">
|
<div class="menu-icon hover-highlight">
|
||||||
<div class="usercontext-icon"
|
<div class="usercontext-icon"
|
||||||
data-identity-icon="${identity.icon}"
|
data-identity-icon="${identity.icon}"
|
||||||
data-identity-color="${identity.color}">
|
data-identity-color="${identity.color}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="menu-text">${identity.name}</span>`;
|
<span class="menu-text">${identity.name}</span>
|
||||||
|
<span class="move-button">
|
||||||
|
<img
|
||||||
|
class="pop-button-image"
|
||||||
|
src="/img/container-move.svg"
|
||||||
|
/>
|
||||||
|
</span>`;
|
||||||
|
|
||||||
fragment.appendChild(tr);
|
fragment.appendChild(tr);
|
||||||
|
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
|
|
||||||
|
tr.draggable = true;
|
||||||
|
tr.dataset.containerId = identity.cookieStoreId;
|
||||||
|
tr.addEventListener("dragstart", (e) => {
|
||||||
|
e.dataTransfer.setData(CONTAINER_DRAG_DATA_TYPE, identity.cookieStoreId);
|
||||||
|
});
|
||||||
|
tr.addEventListener("dragover", (e) => {
|
||||||
|
if (e.dataTransfer.types.includes(CONTAINER_DRAG_DATA_TYPE)) {
|
||||||
|
tr.classList.add("drag-over");
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tr.addEventListener("dragenter", (e) => {
|
||||||
|
if (e.dataTransfer.types.includes(CONTAINER_DRAG_DATA_TYPE)) {
|
||||||
|
e.preventDefault();
|
||||||
|
tr.classList.add("drag-over");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tr.addEventListener("dragleave", (e) => {
|
||||||
|
if (e.dataTransfer.types.includes(CONTAINER_DRAG_DATA_TYPE)) {
|
||||||
|
e.preventDefault();
|
||||||
|
tr.classList.remove("drag-over");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tr.addEventListener("drop", async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const parent = tr.parentNode;
|
||||||
|
const containerId = e.dataTransfer.getData(CONTAINER_DRAG_DATA_TYPE);
|
||||||
|
let droppedElement;
|
||||||
|
parent.childNodes.forEach((node) => {
|
||||||
|
if (node.dataset.containerId === containerId) {
|
||||||
|
droppedElement = node;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (droppedElement && droppedElement !== tr) {
|
||||||
|
tr.classList.remove("drag-over");
|
||||||
|
parent.insertBefore(droppedElement, tr);
|
||||||
|
await Logic.saveContainerOrder(parent.childNodes);
|
||||||
|
await Logic.refreshIdentities();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Utils.addEnterHandler(tr, () => {
|
Utils.addEnterHandler(tr, () => {
|
||||||
pickedFunction(identity);
|
pickedFunction(identity);
|
||||||
});
|
});
|
||||||
@@ -1038,10 +1110,10 @@ Logic.registerPanel(REOPEN_IN_CONTAINER_PICKER, {
|
|||||||
const pickedFunction = function (identity) {
|
const pickedFunction = function (identity) {
|
||||||
const newUserContextId = Utils.userContextId(identity.cookieStoreId);
|
const newUserContextId = Utils.userContextId(identity.cookieStoreId);
|
||||||
Utils.reloadInContainer(
|
Utils.reloadInContainer(
|
||||||
currentTab.url,
|
currentTab.url,
|
||||||
false,
|
false,
|
||||||
newUserContextId,
|
newUserContextId,
|
||||||
currentTab.index + 1,
|
currentTab.index + 1,
|
||||||
currentTab.active
|
currentTab.active
|
||||||
);
|
);
|
||||||
window.close();
|
window.close();
|
||||||
@@ -1054,7 +1126,7 @@ Logic.registerPanel(REOPEN_IN_CONTAINER_PICKER, {
|
|||||||
tr.classList.add("menu-item", "hover-highlight", "keyboard-nav");
|
tr.classList.add("menu-item", "hover-highlight", "keyboard-nav");
|
||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
|
|
||||||
td.innerHTML = Utils.escaped`
|
td.innerHTML = Utils.escaped`
|
||||||
<div class="menu-icon hover-highlight">
|
<div class="menu-icon hover-highlight">
|
||||||
<div class="mac-icon">
|
<div class="mac-icon">
|
||||||
</div>
|
</div>
|
||||||
@@ -1067,10 +1139,10 @@ Logic.registerPanel(REOPEN_IN_CONTAINER_PICKER, {
|
|||||||
|
|
||||||
Utils.addEnterHandler(tr, () => {
|
Utils.addEnterHandler(tr, () => {
|
||||||
Utils.reloadInContainer(
|
Utils.reloadInContainer(
|
||||||
currentTab.url,
|
currentTab.url,
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
currentTab.index + 1,
|
currentTab.index + 1,
|
||||||
currentTab.active
|
currentTab.active
|
||||||
);
|
);
|
||||||
window.close();
|
window.close();
|
||||||
@@ -1084,7 +1156,7 @@ Logic.registerPanel(REOPEN_IN_CONTAINER_PICKER, {
|
|||||||
tr.setAttribute("tabindex", "0");
|
tr.setAttribute("tabindex", "0");
|
||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
|
|
||||||
td.innerHTML = Utils.escaped`
|
td.innerHTML = Utils.escaped`
|
||||||
<div class="menu-icon hover-highlight">
|
<div class="menu-icon hover-highlight">
|
||||||
<div class="usercontext-icon"
|
<div class="usercontext-icon"
|
||||||
data-identity-icon="${identity.icon}"
|
data-identity-icon="${identity.icon}"
|
||||||
@@ -1125,7 +1197,7 @@ Logic.registerPanel(ALWAYS_OPEN_IN_PICKER, {
|
|||||||
// This method is called when the panel is shown.
|
// This method is called when the panel is shown.
|
||||||
prepare() {
|
prepare() {
|
||||||
Logic.listenToPickerBackButton();
|
Logic.listenToPickerBackButton();
|
||||||
document.getElementById("picker-title").textContent = "Reopen This Site in";
|
document.getElementById("picker-title").textContent = "Always Open in";
|
||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
|
|
||||||
document.getElementById("new-container-div").innerHTML = "";
|
document.getElementById("new-container-div").innerHTML = "";
|
||||||
@@ -1136,7 +1208,7 @@ Logic.registerPanel(ALWAYS_OPEN_IN_PICKER, {
|
|||||||
tr.setAttribute("tabindex", "0");
|
tr.setAttribute("tabindex", "0");
|
||||||
const td = document.createElement("td");
|
const td = document.createElement("td");
|
||||||
|
|
||||||
td.innerHTML = Utils.escaped`
|
td.innerHTML = Utils.escaped`
|
||||||
<div class="menu-icon hover-highlight">
|
<div class="menu-icon hover-highlight">
|
||||||
<div class="usercontext-icon"
|
<div class="usercontext-icon"
|
||||||
data-identity-icon="${identity.icon}"
|
data-identity-icon="${identity.icon}"
|
||||||
@@ -1242,6 +1314,9 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||||||
initialize() {
|
initialize() {
|
||||||
this.initializeRadioButtons();
|
this.initializeRadioButtons();
|
||||||
Utils.addEnterHandler(document.querySelector("#close-container-edit-panel"), () => {
|
Utils.addEnterHandler(document.querySelector("#close-container-edit-panel"), () => {
|
||||||
|
// Resets listener from siteIsolation checkbox to keep the update queue to 0.
|
||||||
|
const siteIsolation = document.querySelector("#site-isolation");
|
||||||
|
siteIsolation.removeEventListener("change", addRemoveSiteIsolation, false);
|
||||||
const formValues = new FormData(this._editForm);
|
const formValues = new FormData(this._editForm);
|
||||||
if (formValues.get("container-id") !== NEW_CONTAINER_ID) {
|
if (formValues.get("container-id") !== NEW_CONTAINER_ID) {
|
||||||
this._submitForm();
|
this._submitForm();
|
||||||
@@ -1337,14 +1412,10 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||||||
containerName.select();
|
containerName.select();
|
||||||
containerName.focus();
|
containerName.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
const siteIsolation = document.querySelector("#site-isolation");
|
const siteIsolation = document.querySelector("#site-isolation");
|
||||||
siteIsolation.checked = !!identity.isIsolated;
|
siteIsolation.checked = !!identity.isIsolated;
|
||||||
siteIsolation.addEventListener( "change", function() {
|
siteIsolation.addEventListener( "change", addRemoveSiteIsolation, false);
|
||||||
browser.runtime.sendMessage({
|
|
||||||
method: "addRemoveSiteIsolation",
|
|
||||||
cookieStoreId: identity.cookieStoreId
|
|
||||||
});
|
|
||||||
});
|
|
||||||
[...document.querySelectorAll("[name='container-color']")].forEach(colorInput => {
|
[...document.querySelectorAll("[name='container-color']")].forEach(colorInput => {
|
||||||
colorInput.checked = colorInput.value === identity.color;
|
colorInput.checked = colorInput.value === identity.color;
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Firefox Multi-Account Containers",
|
"name": "Firefox Multi-Account Containers",
|
||||||
"version": "7.0.1",
|
"version": "7.4.0",
|
||||||
"incognito": "not_allowed",
|
"incognito": "not_allowed",
|
||||||
"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.",
|
"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": {
|
"icons": {
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
"idle",
|
"idle",
|
||||||
"management",
|
"management",
|
||||||
"storage",
|
"storage",
|
||||||
|
"unlimitedStorage",
|
||||||
"tabs",
|
"tabs",
|
||||||
"webRequestBlocking",
|
"webRequestBlocking",
|
||||||
"webRequest"
|
"webRequest"
|
||||||
|
|||||||
@@ -20,6 +20,13 @@
|
|||||||
Enable Sync
|
Enable Sync
|
||||||
</label>
|
</label>
|
||||||
<p><em>This setting allows you to sync your containers and site assignments across devices.</em></p>
|
<p><em>This setting allows you to sync your containers and site assignments across devices.</em></p>
|
||||||
|
<h3>Tab behaviour:</h3>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="replaceTabCheck">
|
||||||
|
Replace tab instead of creating a new one
|
||||||
|
</label>
|
||||||
|
<p><em>Replace the current tab if a page which is assigned to another container is opened (instead of keeping the current tab open).
|
||||||
|
Opening tabs with middle mouse button is not affected.</em></p>
|
||||||
<h3>Keyboard Shortcuts:</h3>
|
<h3>Keyboard Shortcuts:</h3>
|
||||||
<p><em>Edit which container is opened when using the numbered shortcuts.</em></p>
|
<p><em>Edit which container is opened when using the numbered shortcuts.</em></p>
|
||||||
<p><label>
|
<p><label>
|
||||||
|
|||||||
+2
-1
@@ -87,7 +87,8 @@ const initializeWithTab = async (details = {
|
|||||||
"browserActionBadgesClicked": [],
|
"browserActionBadgesClicked": [],
|
||||||
"onboarding-stage": 7,
|
"onboarding-stage": 7,
|
||||||
"achievements": [],
|
"achievements": [],
|
||||||
"syncEnabled": true
|
"syncEnabled": true,
|
||||||
|
"replaceTabEnabled": false
|
||||||
});
|
});
|
||||||
window.browser.storage.local.set.resetHistory();
|
window.browser.storage.local.set.resetHistory();
|
||||||
window.browser.storage.sync.clear();
|
window.browser.storage.sync.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user