1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 00:17:58 +01:00

Add 'titlestring' to Muttator.

This commit is contained in:
Doug Kearns
2009-07-15 17:59:57 +10:00
parent dbf017bf21
commit f57d0c05a9
5 changed files with 43 additions and 41 deletions

View File

@@ -242,6 +242,42 @@ const liberator = (function () //{{{
"Load plugin scripts when starting up",
"boolean", true);
options.add(["titlestring"],
"Change the title of the window",
"string", config.defaults.titlestring || config.hostApplication,
{
setter: function (value)
{
let win = document.documentElement;
function updateTitle(old, current)
{
document.title = document.title.replace(RegExp("(.*)" + util.escapeRegex(old)), "$1" + current);
}
// TODO: remove this FF3.5 test when we no longer support 3.0
// : make this a config feature
if (services.get("privateBrowsing"))
{
let oldValue = win.getAttribute("titlemodifier_normal");
let suffix = win.getAttribute("titlemodifier_privatebrowsing").substr(oldValue.length);
win.setAttribute("titlemodifier_normal", value);
win.setAttribute("titlemodifier_privatebrowsing", value + suffix);
if (services.get("privateBrowsing").privateBrowsingEnabled)
{
updateTitle(oldValue + suffix, value + suffix);
return value;
}
}
updateTitle(win.getAttribute("titlemodifier"), value);
win.setAttribute("titlemodifier", value);
return value;
}
});
options.add(["verbose", "vbs"],
"Define which info messages are displayed",
"number", 1,