summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/content/buffer.js10
-rw-r--r--common/content/events.js32
-rw-r--r--common/content/tabs.js14
-rw-r--r--common/content/ui.js12
-rw-r--r--muttator/content/config.js15
-rw-r--r--vimperator/content/config.js6
-rwxr-xr-xxulmus/content/config.js18
7 files changed, 59 insertions, 48 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index 8534f4ee..19a449c7 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -217,10 +217,10 @@ function Buffer() //{{{
"Stop loading",
function ()
{
- if(config.name == "Xulmus")
- getBrowser().mCurrentBrowser.stop();
+ if(config.stop)
+ config.stop();
else
- window.BrowserStop();
+ window.BrowserStop();
});
// scrolling
@@ -605,8 +605,8 @@ function Buffer() //{{{
"Stop loading",
function ()
{
- if (config.name == "Xulmus")
- getBrowser().mCurrentBrowser.stop();
+ if (config.stop)
+ config.stop();
else
window.BrowserStop();
},
diff --git a/common/content/events.js b/common/content/events.js
index e08731f9..1eef6fd5 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -1212,36 +1212,8 @@ function Events() //{{{
return;
}
- if (config.name == "Muttator")
- {
- // we switch to -- MESSAGE -- mode for Muttator, when the main HTML widget gets focus
- if (hasHTMLDocument(win) || elem instanceof HTMLAnchorElement)
- {
- if (config.isComposeWindow)
- {
- //liberator.dump("Compose editor got focus");
- modes.set(modes.INSERT, modes.TEXTAREA);
- }
- else if (liberator.mode != modes.MESSAGE)
- liberator.mode = modes.MESSAGE;
- return;
- }
- }
-
- if (config.name == "Xulmus")
- {
- // Switch to -- PLAYER -- mode for Songbird Media Player.
- if (config.isPlayerWindow)
- {
- liberator.mode = modes.PLAYER;
- }
- else
- {
- liberator.mode = modes.NORMAL;
- }
- return;
- }
-
+ if (config.focusChange())
+ return void config.focusChange(win);
urlbar = document.getElementById("urlbar");
if (elem == null && urlbar && urlbar.inputField == lastFocus)
diff --git a/common/content/tabs.js b/common/content/tabs.js
index 6c4eb16d..113785bf 100644
--- a/common/content/tabs.js
+++ b/common/content/tabs.js
@@ -109,17 +109,14 @@ function Tabs() //{{{
// hide tabs initially
if (config.name == "Vimperator")
getBrowser().mStrip.getElementsByClassName("tabbrowser-tabs")[0].collapsed = true;
-/*
- if (config.name == "Xulmus")
- getBrowser()._strip.getElementsByClassName(
-*/
+
/////////////////////////////////////////////////////////////////////////////}}}
////////////////////// OPTIONS /////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
options.add(["showtabline", "stal"],
"Control when to show the tab bar of opened web pages",
- "number", config.name == "Vimperator" ? 2 : 0,
+ "number", config.optionDefaults['stal'],
{
setter: function (value)
{
@@ -151,7 +148,7 @@ function Tabs() //{{{
validator: Option.validateCompleter
});
- if (config.name == "Vimperator" || config.name == "Xulmus" )
+ if (config.hasTabbrowser)
{
options.add(["activate", "act"],
"Define when tabs are automatically activated",
@@ -241,7 +238,7 @@ function Tabs() //{{{
function (count) { tabs.select("-" + (count < 1 ? 1 : count), true); },
{ flags: Mappings.flags.COUNT });
- if (config.name == "Vimperator" || config.name == "Xulmus")
+ if (config.hasTabbrowser)
{
mappings.add([modes.NORMAL], ["b"],
"Open a prompt to switch buffers",
@@ -452,7 +449,7 @@ function Tabs() //{{{
function () { tabs.select(0, false); },
{ argCount: "0" });
- if (config.name == "Vimperator" || config.name == "Xulmus")
+ if (config.hasTabbrowser)
{
// TODO: "Zero count" if 0 specified as arg, multiple args and count ranges?
commands.add(["b[uffer]"],
@@ -587,6 +584,7 @@ function Tabs() //{{{
});
}
+ /* Why not xulmus? */
if (liberator.has("session") && config.name != "Xulmus")
{
// TODO: extract common functionality of "undoall"
diff --git a/common/content/ui.js b/common/content/ui.js
index d01f2a2c..af7fccd1 100644
--- a/common/content/ui.js
+++ b/common/content/ui.js
@@ -2077,22 +2077,24 @@ function StatusLine() //{{{
}
// when session information is available, add [+] when we can go backwards
- if (config.name == "Vimperator")
+ let modified = "";
+ if (window.getWebNavigation)
{
let sh = window.getWebNavigation().sessionHistory;
- let modified = "";
if (sh.index > 0)
modified += "+";
if (sh.index < sh.count -1)
modified += "-";
+ }
+ if (liberator.has("bookmarks")) {
if (bookmarks.isBookmarked(buffer.URL))
modified += "\u2764"; // a heart symbol: ❤
//modified += "\u2665"; // a heart symbol: ♥
-
- if (modified)
- url += " [" + modified + "]";
}
+ if (modified)
+ url += " [" + modified + "]";
+
urlWidget.value = url;
},
diff --git a/muttator/content/config.js b/muttator/content/config.js
index 6b1979bb..8fe8adf7 100644
--- a/muttator/content/config.js
+++ b/muttator/content/config.js
@@ -102,6 +102,17 @@ const config = { //{{{
function () { buffer.viewSelectionSource(); }]*/
],
+ focusChange: function(win) {
+ // we switch to -- MESSAGE -- mode for Muttator, when the main HTML widget gets focus
+ if (hasHTMLDocument(win) || elem instanceof HTMLAnchorElement)
+ {
+ if (config.isComposeWindow)
+ modes.set(modes.INSERT, modes.TEXTAREA);
+ else if (liberator.mode != modes.MESSAGE)
+ liberator.mode = modes.MESSAGE;
+ }
+ },
+
// they are sorted by relevance, not alphabetically
helpFiles: ["intro.html", "version.html"],
/* "tutorial.html", "starting.html",
@@ -111,6 +122,10 @@ const config = { //{{{
"various.html"
],*/
+ optionDefaults: {
+ stal: 2,
+ },
+
scripts: [
"addressbook.js",
"mail.js",
diff --git a/vimperator/content/config.js b/vimperator/content/config.js
index 1a37841a..b60f997d 100644
--- a/vimperator/content/config.js
+++ b/vimperator/content/config.js
@@ -110,6 +110,8 @@ const config = { //{{{
function () { buffer.viewSelectionSource(); }]
],
+ hasTabbrowser: true,
+
// they are sorted by relevance, not alphabetically
helpFiles: [
"intro.html", "tutorial.html", "starting.html", "browsing.html",
@@ -120,6 +122,10 @@ const config = { //{{{
"various.html", "index.html", "version.html"
],
+ optionDefaults: {
+ stal: 0,
+ },
+
scripts: [
"bookmarks.js",
"tabs.js",
diff --git a/xulmus/content/config.js b/xulmus/content/config.js
index a83bfb74..8961cc28 100755
--- a/xulmus/content/config.js
+++ b/xulmus/content/config.js
@@ -115,6 +115,16 @@ const config = { //{{{
function () { buffer.viewSelectionSource(); }]
],
+ focusChange: function() {
+ // Switch to -- PLAYER -- mode for Songbird Media Player.
+ if (config.isPlayerWindow)
+ liberator.mode = modes.PLAYER;
+ else
+ liberator.mode = modes.NORMAL;
+ },
+
+ hasTabbrowser: true,
+
//TODO : Write intro.html and tutorial.html
// they are sorted by relevance, not alphabetically
//helpFiles: [ "intro.html" ],
@@ -126,12 +136,20 @@ const config = { //{{{
"various.html", "index.html", "version.html"
], */
+ optionDefaults: {
+ stal: 0,
+ },
+
scripts: [
"bookmarks.js",
"tabs.js",
"player.js",
],
+ stop: function() {
+ getBrowser().mCurrentBrowser.stop();
+ },
+
init: function ()
{
//Adding a mode for Player