From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../migration/content/migration-wizard.mjs | 155 +++++++++++++++++++-- 1 file changed, 143 insertions(+), 12 deletions(-) (limited to 'browser/components/migration/content') diff --git a/browser/components/migration/content/migration-wizard.mjs b/browser/components/migration/content/migration-wizard.mjs index 7643e4bce3..6fc7a715d7 100644 --- a/browser/components/migration/content/migration-wizard.mjs +++ b/browser/components/migration/content/migration-wizard.mjs @@ -38,7 +38,7 @@ export class MigrationWizard extends HTMLElement {
-

+

@@ -46,12 +46,13 @@ export class MigrationWizard extends HTMLElement { - +
-

+

+ - +
@@ -582,6 +583,18 @@ export class MigrationWizard extends HTMLElement { "div[name='page-selection']" ); + if (this.hasAttribute("selection-header-string")) { + selectionPage.querySelector(".migration-wizard-header").textContent = + this.getAttribute("selection-header-string"); + } + + let selectionSubheaderString = this.getAttribute( + "selection-subheader-string" + ); + let subheader = selectionPage.querySelector(".migration-wizard-subheader"); + subheader.textContent = selectionSubheaderString; + subheader.toggleAttribute("hidden", !selectionSubheaderString); + let details = this.#shadowRoot.querySelector("details"); if (this.hasAttribute("force-show-import-all")) { @@ -596,6 +609,8 @@ export class MigrationWizard extends HTMLElement { this.#expandedDetails = false; + this.#applyContentCustomizations(); + for (let migrator of state.migrators) { let opt = document.createElement("panel-item"); opt.setAttribute("key", migrator.key); @@ -772,6 +787,7 @@ export class MigrationWizard extends HTMLElement { MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.EXTENSIONS ) { messageText.textContent = ""; + this.#extensionsSuccessLink.target = "_blank"; this.#extensionsSuccessLink.textContent = state.progress[resourceType].message; } @@ -787,6 +803,7 @@ export class MigrationWizard extends HTMLElement { messageText.textContent = state.progress[resourceType].message; supportLink.textContent = state.progress[resourceType].linkText; supportLink.href = state.progress[resourceType].linkURL; + supportLink.target = "_blank"; remainingProgressGroups--; totalWarnings++; break; @@ -800,11 +817,13 @@ export class MigrationWizard extends HTMLElement { messageText.textContent = state.progress[resourceType].message; supportLink.textContent = state.progress[resourceType].linkText; supportLink.href = state.progress[resourceType].linkURL; + supportLink.target = "_blank"; if ( resourceType == MigrationWizardConstants.DISPLAYED_RESOURCE_TYPES.EXTENSIONS ) { messageText.textContent = ""; + this.#extensionsSuccessLink.target = "_blank"; this.#extensionsSuccessLink.textContent = state.progress[resourceType].message; } @@ -816,16 +835,20 @@ export class MigrationWizard extends HTMLElement { let migrationDone = remainingProgressGroups == 0; let headerL10nID = "migration-wizard-progress-header"; + let header = this.#shadowRoot.getElementById("progress-header"); if (migrationDone) { if (totalWarnings) { headerL10nID = "migration-wizard-progress-done-with-warnings-header"; + } else if (this.getAttribute("data-import-complete-success-string")) { + header.textContent = this.getAttribute( + "data-import-complete-success-string" + ); } else { headerL10nID = "migration-wizard-progress-done-header"; } } - let header = this.#shadowRoot.getElementById("progress-header"); document.l10n.setAttributes(header, headerL10nID); let finishButtons = progressPage.querySelectorAll(".finish-button"); @@ -1233,7 +1256,10 @@ export class MigrationWizard extends HTMLElement { let importButton = this.#shadowRoot.querySelector("#import"); importButton.disabled = checkedResources == 0; - if (checkedResources == 0) { + if (this.hasAttribute("option-expander-title-string")) { + let optionString = this.getAttribute("option-expander-title-string"); + selectedDataHeader.textContent = optionString; + } else if (checkedResources == 0) { document.l10n.setAttributes( selectedDataHeader, "migration-no-selected-data-label" @@ -1260,6 +1286,111 @@ export class MigrationWizard extends HTMLElement { ); } + /** + * Updates content and layout to apply changes that are + * informed through element attributes + */ + #applyContentCustomizations() { + let selectionPage = this.#shadowRoot.querySelector( + "div[name='page-selection']" + ); + if (this.hasAttribute("hide-select-all")) { + let hideSelectAll = this.getAttribute("hide-select-all"); + + selectionPage.toggleAttribute("hide-select-all", hideSelectAll); + } else { + selectionPage.removeAttribute("hide-select-all"); + } + + if (this.hasAttribute("import-button-string")) { + if (this.getAttribute("import-button-string")) { + this.#importButton.textContent = this.getAttribute( + "import-button-string" + ); + } + } + + if (this.hasAttribute("checkbox-margin-inline")) { + let inlineMargin = this.getAttribute("checkbox-margin-inline"); + this.style.setProperty( + "--resource-type-label-margin-inline", + inlineMargin + ); + } + + if (this.hasAttribute("checkbox-margin-block")) { + let blockMargin = this.getAttribute("checkbox-margin-block"); + this.style.setProperty("--resource-type-label-margin-block", blockMargin); + } + + if (this.hasAttribute("import-button-class")) { + let importButtonClass = this.getAttribute("import-button-class"); + if (importButtonClass) { + this.#importButton.classList.add(importButtonClass); + } + } + + if (this.hasAttribute("header-font-size")) { + let headerFontSize = this.getAttribute("header-font-size"); + if (headerFontSize) { + this.style.setProperty( + "--embedded-wizard-header-font-size", + headerFontSize + ); + } + } + + if (this.hasAttribute("header-font-weight")) { + let headerFontWeight = this.getAttribute("header-font-weight"); + if (headerFontWeight) { + this.style.setProperty( + "--embedded-wizard-header-font-weight", + headerFontWeight + ); + } + } + + if (this.hasAttribute("header-margin-block")) { + let headerMarginBlock = this.getAttribute("header-margin-block"); + if (headerMarginBlock) { + this.style.setProperty( + "--embedded-wizard-header-margin-block", + headerMarginBlock + ); + } + } + + if (this.hasAttribute("subheader-font-size")) { + let subheaderFontSize = this.getAttribute("subheader-font-size"); + if (subheaderFontSize) { + this.style.setProperty( + "--embedded-wizard-subheader-font-size", + subheaderFontSize + ); + } + } + + if (this.hasAttribute("subheader-font-weight")) { + let subheaderFontWeight = this.getAttribute("subheader-font-weight"); + if (subheaderFontWeight) { + this.style.setProperty( + "--embedded-wizard-subheader-font-weight", + subheaderFontWeight + ); + } + } + + if (this.hasAttribute("subheader-margin-block")) { + let subheaderMarginBlock = this.getAttribute("subheader-margin-block"); + if (subheaderMarginBlock) { + this.style.setProperty( + "--embedded-wizard-subheader-margin-block", + subheaderMarginBlock + ); + } + } + } + handleEvent(event) { switch (event.type) { case "click": { -- cgit v1.2.3