summaryrefslogtreecommitdiffstats
path: root/browser/components/newtab/lib/AboutPreferences.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /browser/components/newtab/lib/AboutPreferences.sys.mjs
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/newtab/lib/AboutPreferences.sys.mjs')
-rw-r--r--browser/components/newtab/lib/AboutPreferences.sys.mjs34
1 files changed, 26 insertions, 8 deletions
diff --git a/browser/components/newtab/lib/AboutPreferences.sys.mjs b/browser/components/newtab/lib/AboutPreferences.sys.mjs
index 08e0ca422a..7d13214361 100644
--- a/browser/components/newtab/lib/AboutPreferences.sys.mjs
+++ b/browser/components/newtab/lib/AboutPreferences.sys.mjs
@@ -50,6 +50,26 @@ const PREFS_BEFORE_SECTIONS = () => [
rowsPref: "topSitesRows",
eventSource: "TOP_SITES",
},
+ {
+ id: "weather",
+ icon: "chrome://browser/skin/weather/sunny.svg",
+ pref: {
+ feed: "showWeather",
+ titleString: "home-prefs-weather-header",
+ descString: "home-prefs-weather-description",
+ learnMore: {
+ link: {
+ href: "https://support.mozilla.org/kb/customize-items-on-firefox-new-tab-page",
+ id: "home-prefs-weather-learn-more-link",
+ },
+ },
+ },
+ eventSource: "WEATHER",
+ shouldHidePref: !Services.prefs.getBoolPref(
+ "browser.newtabpage.activity-stream.system.showWeather",
+ false
+ ),
+ },
];
export class AboutPreferences {
@@ -74,7 +94,7 @@ export class AboutPreferences {
break;
// This is used to open the web extension settings page for an extension
case at.OPEN_WEBEXT_SETTINGS:
- action._target.browser.ownerGlobal.BrowserOpenAddonsMgr(
+ action._target.browser.ownerGlobal.BrowserAddonUI.openAddonsMgr(
`addons://detail/${encodeURIComponent(action.data)}`
);
break;
@@ -213,15 +233,13 @@ export class AboutPreferences {
linkPref(checkbox, name, "bool");
- // Specially add a link for stories
- if (id === "topstories") {
- const sponsoredHbox = createAppend("hbox", sectionVbox);
- sponsoredHbox.setAttribute("align", "center");
- sponsoredHbox.appendChild(checkbox);
+ // Specially add a link for Recommended stories and Weather
+ if (id === "topstories" || id === "weather") {
+ const hboxWithLink = createAppend("hbox", sectionVbox);
+ hboxWithLink.appendChild(checkbox);
checkbox.classList.add("tail-with-learn-more");
- const link = createAppend("label", sponsoredHbox, { is: "text-link" });
- link.classList.add("learn-sponsored");
+ const link = createAppend("label", hboxWithLink, { is: "text-link" });
link.setAttribute("href", sectionData.pref.learnMore.link.href);
document.l10n.setAttributes(link, sectionData.pref.learnMore.link.id);
}