1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 01:42:26 +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

1
NEWS
View File

@@ -7,6 +7,7 @@
special versions for the old behavior
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
VimperatorLeave respectively
* add DOMLoad autocmd event
* add :messages and 'messages'
* add :runtime
* add 'runtimepath'

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"],

View File

@@ -21,6 +21,7 @@ Available {events}:
`--------------------`----------------------------------------
*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 navigating to a new location
*PageLoadPre* Triggered after a page load is initiated.
*PageLoad* Triggered when a page gets (re)loaded/opened

View File

@@ -32,8 +32,8 @@ syn match vimperatorCommand "!" contained
syn keyword vimperatorAutoCmd au[tocmd] contained nextgroup=vimperatorAutoEventList skipwhite
syn keyword vimperatorAutoEvent BookmarkAdd LocationChange PageLoadPre PageLoad ShellCmdPost VimperatorEnter VimperatorLeavePre
\ VimperatorLeave
syn keyword vimperatorAutoEvent BookmarkAdd DOMLoad LocationChange PageLoadPre PageLoad ShellCmdPost VimperatorEnter
\ VimperatorLeavePre VimperatorLeave
\ contained
syn match vimperatorAutoEventList "\(\a\+,\)*\a\+" contained contains=vimperatorAutoEvent