diff --git a/common/content/events.js b/common/content/events.js
index c9e1af3e..3d96a76b 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -364,19 +364,20 @@ function Events() //{{{
if (liberator.has("tabs"))
{
- let tabcontainer = getBrowser().mTabContainer;
- if (tabcontainer) // not every VIM-like extension has a tab container
- {
- tabcontainer.addEventListener("TabMove", function (event) {
+ // FIXME: most of this doesn't work for Muttator yet.
+ liberator.registerObserver("load_tabs", function () {
+ let tabContainer = tabs.getBrowser().mTabContainer;
+
+ tabContainer.addEventListener("TabMove", function (event) {
statusline.updateTabCount();
}, false);
- tabcontainer.addEventListener("TabOpen", function (event) {
+ tabContainer.addEventListener("TabOpen", function (event) {
statusline.updateTabCount();
}, false);
- tabcontainer.addEventListener("TabClose", function (event) {
+ tabContainer.addEventListener("TabClose", function (event) {
statusline.updateTabCount();
}, false);
- tabcontainer.addEventListener("TabSelect", function (event) {
+ tabContainer.addEventListener("TabSelect", function (event) {
// TODO: is all of that necessary?
modes.reset();
// XXX: apparently the tab container hasn't updated mTabs yet
@@ -386,19 +387,19 @@ function Events() //{{{
if (options["focuscontent"])
setTimeout(function () { liberator.focusContent(true); }, 10); // just make sure, that no widget has focus
}, false);
- }
- getBrowser().addEventListener("DOMContentLoaded", onDOMContentLoaded, true);
+ tabs.getBrowser().addEventListener("DOMContentLoaded", onDOMContentLoaded, true);
- // this adds an event which is is called on each page load, even if the
- // page is loaded in a background tab
- getBrowser().addEventListener("load", onPageLoad, true);
+ // this adds an event which is is called on each page load, even if the
+ // page is loaded in a background tab
+ tabs.getBrowser().addEventListener("load", onPageLoad, true);
- // called when the active document is scrolled
- getBrowser().addEventListener("scroll", function (event) {
- statusline.updateBufferPosition();
- modes.show();
- }, null);
+ // called when the active document is scrolled
+ tabs.getBrowser().addEventListener("scroll", function (event) {
+ statusline.updateBufferPosition();
+ modes.show();
+ }, null);
+ });
}
// getBrowser().addEventListener("submit", function (event) {
diff --git a/common/content/tabs.js b/common/content/tabs.js
index 18903358..0506a381 100644
--- a/common/content/tabs.js
+++ b/common/content/tabs.js
@@ -721,6 +721,8 @@ function Tabs() //{{{
return store.options;
},
+ getBrowser: getBrowser,
+
/**
* Returns the local state store for the tab at the specified
* tabIndex. If tabIndex is not specified then the
diff --git a/muttator/NEWS b/muttator/NEWS
index fe6802ea..61eb52cf 100644
--- a/muttator/NEWS
+++ b/muttator/NEWS
@@ -1,5 +1,6 @@
2009-XX-XX
* version 0.6a1pre
+ * add a DOMLoad autocommand event
* add 'online' option
* add 'smtpserver' option
diff --git a/muttator/content/config.js b/muttator/content/config.js
index 4bd607ff..6b792daa 100644
--- a/muttator/content/config.js
+++ b/muttator/content/config.js
@@ -55,7 +55,8 @@ const config = { //{{{
get visualbellWindow() document.getElementById(this.mainWindowID),
styleableChrome: "chrome://messenger/content/messenger.xul,chrome://messenger/content/messengercompose/messengercompose.xul",
- autocommands: [["FolderLoaded", "Triggered after switching folders in Thunderbird"],
+ autocommands: [["DOMLoad", "Triggered when a page's DOM content has fully loaded"],
+ ["FolderLoaded", "Triggered after switching folders in Thunderbird"],
["PageLoadPre", "Triggered after a page load is initiated"],
["PageLoad", "Triggered when a page gets (re)loaded/opened"],
["MuttatorEnter", "Triggered after Thunderbird starts"],