Skip to content

Commit

Permalink
Added customize title bar options
Browse files Browse the repository at this point in the history
* Increased the size of the Customize Title bar window
* Optimized the order of the Customize Title bar Variables
* Added Customize Title bar Variable Application Title and Version
* Added Customize Title bar Variable Application Display Version
* Added Customize Title bar Variable Application Version Pretty
* Added Customize Title bar Variable Application Update Channel
* Added Customize Title bar Variable Application Update Channel Pretty
(Release, ESR, beta, Aurora, Nighty, Default)
* Added Customize Title bar Variable Application Beta Revision (only
filled when applicable)
* Added Customize Title bar Variable Application Version and Channel
* Removed Gecko Build Identifier, since it used PlatformBuildID, just
like XUL Platform Build Identifier
* Removed Gecko Version, since it used PlatformVersion, just like XUL
Platform Version
  • Loading branch information
UtiluMark committed Aug 23, 2016
1 parent 5302a7f commit 21610a0
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 32 deletions.
61 changes: 52 additions & 9 deletions extension/chrome/content/nightly.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* 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/. */

Cu.import("resource://gre/modules/AppConstants.jsm");

var nightly = {

variables: {
Expand All @@ -15,20 +17,27 @@ variables: {
return this._appInfo;
},

get titleversion() { return this.tabtitle + ' - ' + this.vendor + ' ' + this.name + ' ' + this.versionchannel + ' (' + this.appbuildid + ')'; },
get defaulttitle() { return nightlyApp.defaultTitle; },
get tabtitle() { return nightlyApp.tabTitle; },
get appid() this.appInfo.ID,
brandname: null,
get vendor() {
// Fix for vendor not being set in Mozilla Thunderbird
return this.appInfo.name == "Thunderbird" && this.appInfo.vendor == "" ? "Mozilla" : this.appInfo.vendor;
},
get name() this.appInfo.name,
get version() this.appInfo.version,
get appbuildid() this.appInfo.appBuildID,
get platformbuildid() this.appInfo.platformBuildID,
get versionpretty() { return nightly.makeVersionPretty(this.version); },
get displayversion() { return AppConstants.MOZ_APP_VERSION_DISPLAY; },
get channel() { return nightly.updateChannel(); },
get channelpretty() { return nightly.updateChannelPretty(); },
get betarevision() { return nightly.betaRevision(this.version, this.displayversion); },
get versionchannel() { return nightly.versionAndChannel(this.version, this.displayversion); },
get platformversion() this.appInfo.platformVersion,
get geckobuildid() this.appInfo.platformBuildID,
get geckoversion() this.appInfo.platformVersion,
get platformbuildid() this.appInfo.platformBuildID,
get appbuildid() this.appInfo.appBuildID,
get changeset() { return nightly.getChangeset(); },
brandname: null,
get useragent() navigator.userAgent,
get locale() {
var registry = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
Expand All @@ -38,11 +47,9 @@ variables: {
get os() this.appInfo.OS,
get processor() this.appInfo.XPCOMABI.split("-")[0],
get compiler() this.appInfo.XPCOMABI.split(/-(.*)$/)[1],
get defaulttitle() { return nightlyApp.defaultTitle; },
get tabscount() { return nightlyApp.tabsCount; },
get tabtitle() { return nightlyApp.tabTitle; },
profile: null,
toolkit: "cairo",
profile: null,
get tabscount() { return nightlyApp.tabsCount; },
flags: ""
},

Expand Down Expand Up @@ -259,6 +266,42 @@ parseHTML: function(url, callback) {
frame.contentDocument.location.href = url;
},

makeVersionPretty: function(ver) {
ver = ver.replace('0a2','0.0.0');
ver = ver.replace('0a1','0.0.0');
while (ver.match(new RegExp('\\.','g')).length < 3) { ver += '.0'; }
return ver;
},
updateChannel: function() {
return Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService).getBranch("app.update.").getCharPref("channel");
},
updateChannelPretty: function() {
var channel = nightly.updateChannel();
if (channel == 'release') { channel = 'Release' }
else if (channel == 'esr') { channel = 'ESR' }
else if (channel == 'beta') { channel = 'beta' }
else if (channel == 'aurora') { channel = 'Aurora' }
else if (channel == 'nightly') { channel = 'Nighty' }
else if (channel == 'default') { channel = 'Default' }
else channel = '';
return channel;
},
betaRevision: function(ver, displayversion) {
var beta = displayversion.replace(ver + 'b','');
if (beta == displayversion) { beta = ''; };
return beta;
},
versionAndChannel: function(ver, displayversion) {
var channel = nightly.updateChannelPretty();
var beta = nightly.betaRevision(ver, displayversion);
if (channel == 'Release' || channel == 'Default') { channel = ''; }
if (channel == 'beta' && beta != '') { channel += ' ' + beta; }
ver = nightly.makeVersionPretty(ver);
if (channel != '') { ver += ' ' + channel; }
return ver;
},

pastebinAboutSupport: function() {
nightly.parseHTML("about:support", function(doc) {
var contents = doc.getElementById("contents");
Expand Down
31 changes: 19 additions & 12 deletions extension/chrome/content/titlebar/customize.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,33 @@ init: function(aEvent)

paneTitle.bundle=document.getElementById("variablesBundle");

paneTitle.addVariable("AppBuildID");
paneTitle.addVariable("TitleVersion");
paneTitle.addVariable("DefaultTitle");
paneTitle.addVariable("TabTitle");
paneTitle.addVariable("AppID");
paneTitle.addVariable("BrandName");
paneTitle.addVariable("Vendor");
paneTitle.addVariable("Name");
paneTitle.addVariable("Version");
paneTitle.addVariable("VersionPretty");
paneTitle.addVariable("DisplayVersion");
paneTitle.addVariable("Channel");
paneTitle.addVariable("ChannelPretty");
paneTitle.addVariable("BetaRevision");
paneTitle.addVariable("VersionChannel");
paneTitle.addVariable("PlatformVersion");
paneTitle.addVariable("PlatformBuildID");
paneTitle.addVariable("AppBuildID");
paneTitle.addVariable("Changeset");
paneTitle.addVariable("Compiler");
paneTitle.addVariable("DefaultTitle");
paneTitle.addVariable("GeckoVersion");
paneTitle.addVariable("UserAgent");
paneTitle.addVariable("Locale");
paneTitle.addVariable("Name");
paneTitle.addVariable("OS");
paneTitle.addVariable("PlatformBuildID");
paneTitle.addVariable("PlatformVersion");
paneTitle.addVariable("Processor");
paneTitle.addVariable("Compiler");
paneTitle.addVariable("Toolkit");
paneTitle.addVariable("Profile");
paneTitle.addVariable("TabsCount");
paneTitle.addVariable("TabTitle");
paneTitle.addVariable("Toolkit");
paneTitle.addVariable("UserAgent");
paneTitle.addVariable("Vendor");
paneTitle.addVariable("Version");

paneTitle.setupTree();
},

Expand Down
23 changes: 14 additions & 9 deletions extension/chrome/locale/en-US/variables.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
# 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/.
#
variable.TitleVersion.description=Application Title and Version
variable.DefaultTitle.description=Default Application Title
variable.TabTitle.description=Current Tab's Title
variable.AppID.description=Application Identifier
variable.BrandName.description=Application Brand Name
variable.Vendor.description=Application Vendor
variable.Name.description=Application Name
variable.Version.description=Application Version
variable.VersionPretty.description=Application Version Pretty
variable.DisplayVersion.description=Application Display Version
variable.Channel.description=Application Update Channel
variable.ChannelPretty.description=Application Update Channel Pretty
variable.BetaRevision.description=Application Beta Revision
variable.VersionChannel.description=Application Version and Channel
variable.PlatformVersion.description=XUL Platform Version
variable.PlatformBuildID.description=XUL Platform Build Identifier
variable.AppBuildID.description=Application Build Identifier
variable.Changeset.description=Built from that changeset
variable.PlatformBuildID.description=XUL Platform Build Identifier
variable.PlatformVersion.description=XUL Platform Version
variable.GeckoBuildID.description=Gecko Build Identifier
variable.GeckoVersion.description=Gecko Version
variable.BrandName.description=Application Brand Name
variable.UserAgent.description=User Agent String
variable.Locale.description=Current Locale
variable.OS.description=Compilation OS
variable.Processor.description=Compilation Processor
variable.Compiler.description=Compiler
variable.DefaultTitle.description=Default Application Title
variable.TabTitle.description=Current Tab's Title
variable.Profile.description=Current Profile
variable.Toolkit.description=Graphics Toolkit
variable.TabsCount.description=Count of visible tabs
variable.Profile.description=Current Profile
variable.TabsCount.description=Number of visible tabs
4 changes: 2 additions & 2 deletions extension/chrome/skin/titlebar/titlebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#variableTree {
height: 17em;
height: 23em;
}

#NightlyTesterOptions {
width: 42.75em;
width: 56em;
}

0 comments on commit 21610a0

Please sign in to comment.