Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow default title to occur anywhere in title customization

  • Loading branch information...
commit 3bb023c1c4da07e810a99086d859c2f4a591b72c 1 parent f498f49
@harthur harthur authored
View
41 chrome/content/browser.js
@@ -41,6 +41,11 @@ repository: 'mozilla-central',
storedTitle: document.documentElement.getAttribute("titlemodifier"),
+get defaultTitle() {
+ var tabbrowser = document.getElementById("content");
+ return tabbrowser.getWindowTitleForBrowser(tabbrowser.mCurrentBrowser);
+},
+
init: function()
{
var brandbundle = document.getElementById("bundle_brand");
@@ -50,7 +55,12 @@ init: function()
}
nightly.variables.brandname=brandbundle.getString("brandFullName");
nightly.variables.defaulttitle=nightlyApp.storedTitle;
- document.getElementById("content").addEventListener("DOMTitleChanged",nightlyApp.titleUpdated,false);
+
+ var tabbrowser = document.getElementById("content");
+ nightlyApp.oldUpdateTitlebar = tabbrowser.updateTitlebar;
+
+ tabbrowser.updateTitlebar = nightly.updateTitlebar;
+ tabbrowser.addEventListener("DOMTitleChanged", nightly.updateTitlebar, false);
},
openURL: function(url)
@@ -72,38 +82,15 @@ openNotification: function(id, message, label, accessKey, callback) {
message, "urlbar", action, null, options);
},
-titleUpdated: function()
-{
- if (!gBrowser.mTabbedMode)
- {
- gBrowser.updateTitlebar();
- }
-},
-
-updateTitlebar: function()
-{
- window.setTimeout("gBrowser.updateTitlebar();", 50);
-},
-
setCustomTitle: function(title)
{
- document.documentElement.setAttribute("titlemodifier",title);
- document.documentElement.setAttribute("titlemenuseparator"," - ");
- nightlyApp.updateTitlebar();
-},
-
-setBlankTitle: function()
-{
- document.documentElement.setAttribute("titlemodifier","");
- document.documentElement.setAttribute("titlemenuseparator","");
- nightlyApp.updateTitlebar();
+ document.getElementById("content").ownerDocument.title = title;
},
setStandardTitle: function()
{
- document.documentElement.setAttribute("titlemodifier",nightlyApp.storedTitle);
- document.documentElement.setAttribute("titlemenuseparator"," - ");
- nightlyApp.updateTitlebar();
+ var tabbrowser = document.getElementById("content");
+ nightlyApp.oldUpdateTitlebar.call(tabbrowser);
}
}
View
25 chrome/content/nightly.js
@@ -67,7 +67,7 @@ variables: {
get os() this.appInfo.OS,
get processor() this.appInfo.XPCOMABI.split("-")[0],
get compiler() this.appInfo.XPCOMABI.split("-")[1],
- defaulttitle: null,
+ get defaulttitle() { return nightlyApp.defaultTitle; },
profile: null,
toolkit: "cairo",
flags: ""
@@ -139,17 +139,18 @@ unload: function(pref) {
},
prefChange: function(pref) {
- if ((pref == "idtitle") || (pref == "templates.title")) {
- if (nightly.preferences.getBoolPref("idtitle")) {
- var title = nightly.getTemplate("title");
- if (title && title.length>0)
- nightlyApp.setCustomTitle(nightly.generateText(title));
- else
- nightlyApp.setBlankTitle();
- }
- else {
- nightlyApp.setStandardTitle();
- }
+ if ((pref == "idtitle") || (pref == "templates.title"))
+ nightly.updateTitlebar();
+},
+
+updateTitlebar: function()
+{
+ if (nightly.preferences.getBoolPref("idtitle")) {
+ var title = nightly.getTemplate("title");
+ nightlyApp.setCustomTitle(nightly.generateText(title));
+ }
+ else {
+ nightlyApp.setStandardTitle();
}
},
View
7 chrome/content/titlebar/customize.js
@@ -97,6 +97,13 @@ addVariable: function(name)
value="Undefined";
}
item.appendChild(document.createElement("listcell")).setAttribute('label',value);
+ item.addEventListener("click", function() {
+ var titlebox = document.getElementById("customTitle");
+ var template = titlebox.value + " ${" + name + "}";
+ titlebox.value = template;
+ // manually set pref, pref change isn't triggered if we just set the value
+ paneTitle.nightly.preferences.setCharPref("templates.title", template);
+ }, true);
list.appendChild(item);
},
Please sign in to comment.
Something went wrong with that request. Please try again.