1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 02:37: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,

View File

@@ -1,5 +1,6 @@
2009-XX-XX
* version 0.6a1pre
* add 'titlestring' option
* rename FolderLoaded autocommand event to FolderLoad
* add the DOMLoad autocommand event
* add 'online' option

View File

@@ -37,7 +37,8 @@ const config = { //{{{
features: ["hints", "mail", "marks", "addressbook", "tabs"],
defaults: {
guioptions: "frb",
showtabline: 1
showtabline: 1,
titlestring: "Muttator"
},
guioptions: {

View File

@@ -35,7 +35,8 @@ const config = { //{{{
features: ["bookmarks", "hints", "history", "marks", "quickmarks", "session", "tabs", "tabUndo", "windows"],
defaults: {
guioptions: "rb",
showtabline: 2
showtabline: 2,
titlestring: "Vimperator"
},
guioptions: {
@@ -304,29 +305,6 @@ const config = { //{{{
getter: function () !services.get("io").offline
});
// TODO: merge with Vimperator version and add Muttator version
// (TB handles this differently).
options.add(["titlestring"],
"Change the title of the window",
"string", "Vimperator",
{
setter: function (value)
{
let elem = document.documentElement;
elem.setAttribute("titlemodifier", value);
// TODO: remove this FF3.5 test when we no longer support 3.0
if (services.get("privateBrowsing"))
{
elem.setAttribute("titlemodifier_privatebrowsing", value);
elem.setAttribute("titlemodifier_normal", value);
}
getBrowser().updateTitlebar();
return value;
}
});
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMPLETIONS /////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{

View File

@@ -37,7 +37,8 @@ const config = { //{{{
features: ["bookmarks", "hints", "marks", "history", "quickmarks", "session", "tabs", "windows", "player"],
defaults: {
guioptions: "mprb",
showtabline: 2
showtabline: 2,
titlestring: "Xulmus"
},
guioptions: {
@@ -374,21 +375,6 @@ const config = { //{{{
getter: function () !services.get("io").offline
});
// TODO: merge with Vimperator version and add Muttator version
// (TB handles this differently).
options.add(["titlestring"],
"Change the title of the window",
"string", "Xulmus",
{
setter: function (value)
{
document.documentElement.setAttribute("titlemodifier", value);
getBrowser().updateTitlebar();
return value;
}
});
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// COMPLETIONS /////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{