1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 14:24:17 +01:00

add DOMLoad autocmd event

This commit is contained in:
Doug Kearns
2008-10-02 06:40:24 +00:00
parent 55ee4e59bf
commit 0a905986d9
5 changed files with 14 additions and 2 deletions

View File

@@ -300,6 +300,8 @@ liberator.Events = function () //{{{
}, false);
}
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);
@@ -447,6 +449,13 @@ liberator.Events = function () //{{{
return false;
}
function onDOMContentLoaded(event)
{
if (event.originalTarget instanceof HTMLDocument)
liberator.autocommands.trigger("DOMLoad", event.originalTarget.location.href);
}
// TODO: see what can be moved to onDOMContentLoaded()
function onPageLoad(event)
{
if (event.originalTarget instanceof HTMLDocument)

View File

@@ -39,6 +39,7 @@ liberator.config = { //{{{
get visualbellWindow() getBrowser().mPanelContainer,
autocommands: [["BookmarkAdd", "Triggered after a page is bookmarked"],
["DOMLoad", "Triggered when a page's DOM content has fully loaded"],
["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"],
["PageLoadPre", "Triggered after a page load is initiated"],
["PageLoad", "Triggered when a page gets (re)loaded/opened"],