Use a different l10n
string for sites opened in no container
https://github.com/mozilla/multi-account-containers/pull/2391
This commit is contained in:
parent
fe05b1b3d8
commit
27d7e22add
1 changed files with 19 additions and 2 deletions
|
@ -12,22 +12,39 @@ async function load() {
|
||||||
denySubmit(redirectUrl);
|
denySubmit(redirectUrl);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById("deny-no-container").addEventListener("click", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
denySubmit(redirectUrl);
|
||||||
|
});
|
||||||
|
|
||||||
const container = await browser.contextualIdentities.get(cookieStoreId);
|
const container = await browser.contextualIdentities.get(cookieStoreId);
|
||||||
const currentContainer = currentCookieStoreId ? await browser.contextualIdentities.get(currentCookieStoreId) : null;
|
const currentContainer = currentCookieStoreId ? await browser.contextualIdentities.get(currentCookieStoreId) : null;
|
||||||
const currentContainerName = currentContainer ? currentContainer.name : "";
|
const currentContainerName = currentContainer ? setDenyButton(currentContainer.name) : setDenyButton("");
|
||||||
|
|
||||||
document.querySelectorAll("[data-message-id]").forEach(el => {
|
document.querySelectorAll("[data-message-id]").forEach(el => {
|
||||||
const elementData = el.dataset;
|
const elementData = el.dataset;
|
||||||
const containerName = elementData.messageArg === "container-name" ? container.name : currentContainerName;
|
const containerName = elementData.messageArg === "container-name" ? container.name : currentContainerName;
|
||||||
el.textContent = browser.i18n.getMessage(elementData.messageId, containerName);
|
el.textContent = browser.i18n.getMessage(elementData.messageId, containerName);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("confirm").addEventListener("click", (e) => {
|
document.getElementById("confirm").addEventListener("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
confirmSubmit(redirectUrl, cookieStoreId);
|
confirmSubmit(redirectUrl, cookieStoreId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setDenyButton(currentContainerName) {
|
||||||
|
const buttonDeny = document.getElementById("deny");
|
||||||
|
const buttonDenyNoContainer = document.getElementById("deny-no-container");
|
||||||
|
|
||||||
|
if (currentContainerName) {
|
||||||
|
buttonDenyNoContainer.style.display = "none";
|
||||||
|
return currentContainerName;
|
||||||
|
}
|
||||||
|
buttonDeny.style.display = "none";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
function appendFavicon(pageUrl, redirectUrlElement) {
|
function appendFavicon(pageUrl, redirectUrlElement) {
|
||||||
const origin = new URL(pageUrl).origin;
|
const origin = new URL(pageUrl).origin;
|
||||||
const favIconElement = Utils.createFavIconElement(`${origin}/favicon.ico`);
|
const favIconElement = Utils.createFavIconElement(`${origin}/favicon.ico`);
|
||||||
|
|
Loading…
Add table
Reference in a new issue