summaryrefslogtreecommitdiffstats
path: root/toolkit/content/widgets/message-bar.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /toolkit/content/widgets/message-bar.js
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/content/widgets/message-bar.js')
-rw-r--r--toolkit/content/widgets/message-bar.js91
1 files changed, 0 insertions, 91 deletions
diff --git a/toolkit/content/widgets/message-bar.js b/toolkit/content/widgets/message-bar.js
deleted file mode 100644
index d38347b40a..0000000000
--- a/toolkit/content/widgets/message-bar.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* 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/. */
-
-"use strict";
-
-// This is loaded into chrome windows with the subscript loader. Wrap in
-// a block to prevent accidentally leaking globals onto `window`.
-{
- class MessageBarElement extends HTMLElement {
- constructor() {
- super();
- const shadowRoot = this.attachShadow({ mode: "open" });
- window.MozXULElement?.insertFTLIfNeeded(
- "toolkit/global/notification.ftl"
- );
- document.l10n.connectRoot(this.shadowRoot);
- const content = this.constructor.template.content.cloneNode(true);
- shadowRoot.append(content);
- this.closeButton.addEventListener("click", () => this.dismiss(), {
- once: true,
- });
- }
-
- disconnectedCallback() {
- this.dispatchEvent(new CustomEvent("message-bar:close"));
- }
-
- get closeButton() {
- return this.shadowRoot.querySelector("button.close");
- }
-
- static get template() {
- const template = document.createElement("template");
-
- const commonStyles = document.createElement("link");
- commonStyles.rel = "stylesheet";
- commonStyles.href = "chrome://global/skin/in-content/common.css";
- const messageBarStyles = document.createElement("link");
- messageBarStyles.rel = "stylesheet";
- messageBarStyles.href =
- "chrome://global/content/elements/message-bar.css";
- template.content.append(commonStyles, messageBarStyles);
-
- // A container for the entire message bar content,
- // most of the css rules needed to provide the
- // expected message bar layout is applied on this
- // element.
- const container = document.createElement("div");
- container.part = "container";
- container.classList.add("container");
- template.content.append(container);
-
- const icon = document.createElement("span");
- icon.classList.add("icon");
- icon.part = "icon";
- container.append(icon);
-
- const barcontent = document.createElement("span");
- barcontent.classList.add("content");
- barcontent.append(document.createElement("slot"));
- container.append(barcontent);
-
- const spacer = document.createElement("span");
- spacer.classList.add("spacer");
- container.append(spacer);
-
- const closeIcon = document.createElement("button");
- closeIcon.classList.add("close", "ghost-button");
- document.l10n.setAttributes(closeIcon, "notification-close-button");
- container.append(closeIcon);
-
- Object.defineProperty(this, "template", {
- value: template,
- });
-
- return template;
- }
-
- dismiss() {
- this.dispatchEvent(new CustomEvent("message-bar:user-dismissed"));
- this.close();
- }
-
- close() {
- this.remove();
- }
- }
-
- customElements.define("message-bar", MessageBarElement);
-}