зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1844848 - Use moz-message-bar in about:plugins. r=tgiles,fluent-reviewers,desktop-theme-reviewers,flod,dao
Differential Revision: https://phabricator.services.mozilla.com/D184773
This commit is contained in:
Родитель
3858f4743f
Коммит
a5744d7258
|
@ -0,0 +1,42 @@
|
|||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
import fluent.syntax.ast as FTL
|
||||
|
||||
from fluent.migrate.transforms import TransformPattern
|
||||
|
||||
|
||||
class STRIP_LEARNMORE(TransformPattern):
|
||||
# Used to remove `<a data-l10n-name="deprecation-link">SOME TEXT</a>` from a string
|
||||
def visit_TextElement(self, node):
|
||||
link_start = node.value.find('<a data-l10n-name="deprecation-link">')
|
||||
if link_start != -1:
|
||||
# Replace string up to the link, remove remaining spaces afterwards.
|
||||
# Removing an extra character directly is not safe, as it could be
|
||||
# punctuation.
|
||||
node.value = node.value[:link_start].rstrip()
|
||||
|
||||
return node
|
||||
|
||||
|
||||
def migrate(ctx):
|
||||
"""Bug 1844848 - Use moz-message-bar in about:plugins , part {index}."""
|
||||
abouPlugins_ftl = "toolkit/toolkit/about/aboutPlugins.ftl"
|
||||
ctx.add_transforms(
|
||||
abouPlugins_ftl,
|
||||
abouPlugins_ftl,
|
||||
[
|
||||
FTL.Message(
|
||||
id=FTL.Identifier("deprecation-description2"),
|
||||
attributes=[
|
||||
FTL.Attribute(
|
||||
id=FTL.Identifier("message"),
|
||||
value=STRIP_LEARNMORE(
|
||||
abouPlugins_ftl,
|
||||
"deprecation-description",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
|
@ -822,6 +822,8 @@
|
|||
return import(
|
||||
"chrome://global/content/elements/moz-button-group.mjs"
|
||||
);
|
||||
case "moz-message-bar":
|
||||
return import("chrome://global/content/elements/moz-message-bar.mjs");
|
||||
case "moz-support-link":
|
||||
return import(
|
||||
"chrome://global/content/elements/moz-support-link.mjs"
|
||||
|
|
|
@ -6,12 +6,6 @@
|
|||
== Styles used by the about:plugins page.
|
||||
======================================================================= */
|
||||
|
||||
body {
|
||||
background-color: Field;
|
||||
color: FieldText;
|
||||
font: message-box;
|
||||
}
|
||||
|
||||
div#outside {
|
||||
text-align: justify;
|
||||
width: 90%;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<title data-l10n-id="title-label"></title>
|
||||
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />
|
||||
<link rel="stylesheet" href="chrome://global/content/plugins.css" />
|
||||
<link rel="localization" href="toolkit/about/aboutPlugins.ftl" />
|
||||
<script src="chrome://global/content/customElements.js"></script>
|
||||
|
@ -21,7 +22,7 @@
|
|||
src="chrome://global/content/elements/moz-support-link.mjs"
|
||||
></script>
|
||||
</head>
|
||||
<body>
|
||||
<body class="main-content">
|
||||
<div id="outside">
|
||||
<script
|
||||
type="application/javascript"
|
||||
|
|
|
@ -18,6 +18,8 @@ navigator.plugins.refresh(false);
|
|||
RPMSendQuery("RequestPlugins", {}).then(aPlugins => {
|
||||
var fragment = document.createDocumentFragment();
|
||||
|
||||
window.ensureCustomElements("moz-message-bar");
|
||||
|
||||
// "Installed plugins"
|
||||
var id, label;
|
||||
if (aPlugins.length) {
|
||||
|
@ -32,12 +34,13 @@ RPMSendQuery("RequestPlugins", {}).then(aPlugins => {
|
|||
document.l10n.setAttributes(enabledplugins, label);
|
||||
fragment.appendChild(enabledplugins);
|
||||
|
||||
let deprecation = document.createElement("message-bar");
|
||||
let deprecation = document.createElement("moz-message-bar");
|
||||
let deprecationLink = document.createElement("a", { is: "moz-support-link" });
|
||||
deprecationLink.setAttribute("data-l10n-name", "deprecation-link");
|
||||
deprecationLink.setAttribute("support-page", "npapi");
|
||||
deprecationLink.setAttribute("slot", "support-link");
|
||||
deprecation.appendChild(deprecationLink);
|
||||
document.l10n.setAttributes(deprecation, "deprecation-description");
|
||||
deprecation.setAttribute("data-l10n-attrs", "message");
|
||||
document.l10n.setAttributes(deprecation, "deprecation-description2");
|
||||
fragment.appendChild(deprecation);
|
||||
|
||||
var stateNames = {};
|
||||
|
|
|
@ -7,7 +7,8 @@ title-label = About Plugins
|
|||
installed-plugins-label = Installed plugins
|
||||
no-plugins-are-installed-label = No installed plugins found
|
||||
|
||||
deprecation-description = Missing something? Some plugins are no longer supported. <a data-l10n-name="deprecation-link">Learn More.</a>
|
||||
deprecation-description2 =
|
||||
.message = Missing something? Some plugins are no longer supported.
|
||||
|
||||
## The information of plugins
|
||||
##
|
||||
|
|
|
@ -98,6 +98,8 @@ class Linter(visitor.Visitor):
|
|||
"searchbuttonlabel",
|
||||
# Used in toolbar customization.
|
||||
"toolbarname",
|
||||
# Used in moz-message-bar.
|
||||
"message",
|
||||
# Used in dialogs (should be moved to using fluent IDs though)
|
||||
"buttonlabelaccept",
|
||||
"buttonaccesskeyaccept",
|
||||
|
|
Загрузка…
Ссылка в новой задаче