diff --git a/assets/aboutDialog/aboutDialog.css b/assets/aboutDialog/aboutDialog.css new file mode 100644 index 0000000..37b8ef9 --- /dev/null +++ b/assets/aboutDialog/aboutDialog.css @@ -0,0 +1,136 @@ +/* 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/. */ +@namespace html "http://www.w3.org/1999/xhtml"; + +#aboutDialog { + width: 620px; + /* Set an explicit line-height to avoid discrepancies in 'auto' spacing + across screens with different device DPI, which may cause font metrics + to round differently. */ + line-height: 1.5; +} + +#rightBox { + background-image: url("chrome://branding/content/about-wordmark.svg"); + background-repeat: no-repeat; + background-size: 288px auto; + /* padding-top creates room for the wordmark */ + padding-top: 38px; + margin-top: 20px; +} + +#rightBox:-moz-locale-dir(rtl) { + background-position: 100% 0; +} + +#bottomBox { + padding: 15px 10px 0; + height: 52px; +} + +#release { + font-weight: bold; + font-size: 125%; + margin-top: 10px; + margin-inline-start: 0; +} + +#version { + font-weight: bold; + margin-inline-start: 0; + user-select: text; + -moz-user-focus: normal; + cursor: text; +} + +#version.update { + font-weight: normal; +} + +#distribution, +#distributionId { + display: none; + margin-block: 0; +} + +.text-blurb { + margin-bottom: 10px; + margin-inline-start: 0; + padding-inline-start: 0; +} + +#updateDeck > *:not(.selected) { + visibility: hidden; +} + +#updateButton, +#updateDeck > hbox > label { + margin-inline-start: 0; + padding-inline-start: 0; +} + +.update-throbber { + width: 16px; + min-height: 16px; + margin-inline-end: 3px; +} + +html|img.update-throbber { + vertical-align: middle; +} + +image.update-throbber { + list-style-image: url("chrome://global/skin/icons/loading.png"); +} + +@media (min-resolution: 1.1dppx) { + .update-throbber { + list-style-image: url("chrome://global/skin/icons/loading@2x.png"); + } +} + +description > .text-link { + margin: 0; + padding: 0; +} + +#submit-feedback { + margin-inline-start: .9em; +} + +.bottom-link { + text-align: center; + margin: 0 40px; +} + +#currentChannel { + margin: 0; + padding: 0; + font-weight: bold; +} + +#updateBox { + line-height: normal; +} + +#icons > .icon { + -moz-context-properties: fill; + margin: 5px; + width: 16px; + height: 16px; +} + +#icons:not(.checkingForUpdates, .downloading, .applying, .restarting) > .update-throbber, +#icons:not(.noUpdatesFound) > .noUpdatesFound, +#icons:not(.apply) > .apply { + display: none; +} + +#icons > .noUpdatesFound { + fill: #30e60b; +} + +#icons > .apply { + fill: white; +} diff --git a/assets/aboutDialog/aboutDialog.js b/assets/aboutDialog/aboutDialog.js new file mode 100644 index 0000000..69e7c51 --- /dev/null +++ b/assets/aboutDialog/aboutDialog.js @@ -0,0 +1,121 @@ +/* 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"; + +/* import-globals-from aboutDialog-appUpdater.js */ + +// Services = object with smart getters for common XPCOM services +var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); +var { AppConstants } = ChromeUtils.import( + "resource://gre/modules/AppConstants.jsm" +); +if (AppConstants.MOZ_UPDATER) { + Services.scriptloader.loadSubScript( + "chrome://browser/content/aboutDialog-appUpdater.js", + this + ); +} + +async function init(aEvent) { + if (aEvent.target != document) { + return; + } + + let defaults = Services.prefs.getDefaultBranch(null); + let distroId = defaults.getCharPref("distribution.id", ""); + if (distroId) { + let distroAbout = defaults.getStringPref("distribution.about", ""); + // If there is about text, we always show it. + if (distroAbout) { + let distroField = document.getElementById("distribution"); + distroField.value = distroAbout; + distroField.style.display = "block"; + } + // If it's not a mozilla distribution, show the rest, + // unless about text exists, then we always show. + if (!distroId.startsWith("mozilla-") || distroAbout) { + let distroVersion = defaults.getCharPref("distribution.version", ""); + if (distroVersion) { + distroId += " - " + distroVersion; + } + + let distroIdField = document.getElementById("distributionId"); + distroIdField.value = distroId; + distroIdField.style.display = "block"; + } + } + + // Include the build ID and display warning if this is an "a#" (nightly or aurora) build + let versionId = "aboutDialog-version"; + let versionAttributes = { + version: AppConstants.MOZ_APP_VERSION_DISPLAY, + bits: Services.appinfo.is64Bit ? 64 : 32, + }; + + let version = Services.appinfo.version; + if (/a\d+$/.test(version)) { + versionId = "aboutDialog-version-nightly"; + let buildID = Services.appinfo.appBuildID; + let year = buildID.slice(0, 4); + let month = buildID.slice(4, 6); + let day = buildID.slice(6, 8); + versionAttributes.isodate = `${year}-${month}-${day}`; + + document.getElementById("experimental").hidden = false; + document.getElementById("communityDesc").hidden = true; + } + + // Use Fluent arguments for append version and the architecture of the build + let versionField = document.getElementById("version"); + + document.l10n.setAttributes(versionField, versionId, versionAttributes); + + await document.l10n.translateElements([versionField]); + + // Show a release notes link if we have a URL. + let relNotesLink = document.getElementById("releasenotes"); + let relNotesPrefType = Services.prefs.getPrefType( + "app.releaseNotesURL.aboutDialog" + ); + if (relNotesPrefType != Services.prefs.PREF_INVALID) { + let relNotesURL = Services.urlFormatter.formatURLPref( + "app.releaseNotesURL.aboutDialog" + ); + if (relNotesURL != "about:blank") { + relNotesLink.href = relNotesURL; + relNotesLink.hidden = false; + } + } + + if (AppConstants.MOZ_UPDATER) { + gAppUpdater = new appUpdater({ buttonAutoFocus: true }); + + let channelLabel = document.getElementById("currentChannel"); + let currentChannelText = document.getElementById("currentChannelText"); + channelLabel.value = UpdateUtils.UpdateChannel; + let hasWinPackageId = false; + try { + hasWinPackageId = Services.sysinfo.getProperty("hasWinPackageId"); + } catch (_ex) { + // The hasWinPackageId property doesn't exist; assume it should be false. + } + if (/^release($|\-)/.test(channelLabel.value) || hasWinPackageId) { + currentChannelText.hidden = true; + } + } + + if (AppConstants.IS_ESR) { + document.getElementById("release").hidden = false; + } + + window.sizeToContent(); + + if (AppConstants.platform == "macosx") { + window.moveTo( + screen.availWidth / 2 - window.outerWidth / 2, + screen.availHeight / 5 + ); + } +} diff --git a/assets/aboutDialog/aboutDialog.xhtml b/assets/aboutDialog/aboutDialog.xhtml new file mode 100644 index 0000000..90a568a --- /dev/null +++ b/assets/aboutDialog/aboutDialog.xhtml @@ -0,0 +1,168 @@ + + +# 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/. + + + + + + +#ifdef XP_MACOSX +#include macWindow.inc.xhtml +#else +