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:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -37,7 +37,8 @@ const config = { //{{{
|
||||
features: ["hints", "mail", "marks", "addressbook", "tabs"],
|
||||
defaults: {
|
||||
guioptions: "frb",
|
||||
showtabline: 1
|
||||
showtabline: 1,
|
||||
titlestring: "Muttator"
|
||||
},
|
||||
|
||||
guioptions: {
|
||||
|
||||
@@ -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 /////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
@@ -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 /////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
Reference in New Issue
Block a user