Merge branch 'master' into proxy-support
This commit is contained in:
commit
9c80f19f2f
5 changed files with 199 additions and 6 deletions
|
@ -25,7 +25,7 @@
|
||||||
"stylelint": "^13.5.0",
|
"stylelint": "^13.5.0",
|
||||||
"stylelint-config-standard": "^20.0.0",
|
"stylelint-config-standard": "^20.0.0",
|
||||||
"stylelint-order": "^4.0.0",
|
"stylelint-order": "^4.0.0",
|
||||||
"web-ext": "^2.9.3",
|
"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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
13
src/img/container-move.svg
Normal file
13
src/img/container-move.svg
Normal file
|
@ -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 |
|
@ -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";
|
||||||
|
@ -192,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) {
|
||||||
|
@ -211,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) {
|
||||||
|
@ -1010,12 +1028,59 @@ Logic.registerPanel(MANAGE_CONTAINERS_PICKER, {
|
||||||
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);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue