mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 03:42:27 +01:00
add DOMLoad autocmd event
This commit is contained in:
1
NEWS
1
NEWS
@@ -7,6 +7,7 @@
|
|||||||
special versions for the old behavior
|
special versions for the old behavior
|
||||||
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
* IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and
|
||||||
VimperatorLeave respectively
|
VimperatorLeave respectively
|
||||||
|
* add DOMLoad autocmd event
|
||||||
* add :messages and 'messages'
|
* add :messages and 'messages'
|
||||||
* add :runtime
|
* add :runtime
|
||||||
* add 'runtimepath'
|
* add 'runtimepath'
|
||||||
|
|||||||
@@ -300,6 +300,8 @@ liberator.Events = function () //{{{
|
|||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBrowser().addEventListener("DOMContentLoaded", onDOMContentLoaded, true);
|
||||||
|
|
||||||
// this adds an event which is is called on each page load, even if the
|
// this adds an event which is is called on each page load, even if the
|
||||||
// page is loaded in a background tab
|
// page is loaded in a background tab
|
||||||
getBrowser().addEventListener("load", onPageLoad, true);
|
getBrowser().addEventListener("load", onPageLoad, true);
|
||||||
@@ -447,6 +449,13 @@ liberator.Events = function () //{{{
|
|||||||
return false;
|
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)
|
function onPageLoad(event)
|
||||||
{
|
{
|
||||||
if (event.originalTarget instanceof HTMLDocument)
|
if (event.originalTarget instanceof HTMLDocument)
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ liberator.config = { //{{{
|
|||||||
get visualbellWindow() getBrowser().mPanelContainer,
|
get visualbellWindow() getBrowser().mPanelContainer,
|
||||||
|
|
||||||
autocommands: [["BookmarkAdd", "Triggered after a page is bookmarked"],
|
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"],
|
["LocationChange", "Triggered when changing tabs or when naviagtion to a new location"],
|
||||||
["PageLoadPre", "Triggered after a page load is initiated"],
|
["PageLoadPre", "Triggered after a page load is initiated"],
|
||||||
["PageLoad", "Triggered when a page gets (re)loaded/opened"],
|
["PageLoad", "Triggered when a page gets (re)loaded/opened"],
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ Available {events}:
|
|||||||
|
|
||||||
`--------------------`----------------------------------------
|
`--------------------`----------------------------------------
|
||||||
*BookmarkAdd* Triggered after a page is bookmarked
|
*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
|
*LocationChange* Triggered when changing tabs or when navigating to a new location
|
||||||
*PageLoadPre* Triggered after a page load is initiated.
|
*PageLoadPre* Triggered after a page load is initiated.
|
||||||
*PageLoad* Triggered when a page gets (re)loaded/opened
|
*PageLoad* Triggered when a page gets (re)loaded/opened
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ syn match vimperatorCommand "!" contained
|
|||||||
|
|
||||||
syn keyword vimperatorAutoCmd au[tocmd] contained nextgroup=vimperatorAutoEventList skipwhite
|
syn keyword vimperatorAutoCmd au[tocmd] contained nextgroup=vimperatorAutoEventList skipwhite
|
||||||
|
|
||||||
syn keyword vimperatorAutoEvent BookmarkAdd LocationChange PageLoadPre PageLoad ShellCmdPost VimperatorEnter VimperatorLeavePre
|
syn keyword vimperatorAutoEvent BookmarkAdd DOMLoad LocationChange PageLoadPre PageLoad ShellCmdPost VimperatorEnter
|
||||||
\ VimperatorLeave
|
\ VimperatorLeavePre VimperatorLeave
|
||||||
\ contained
|
\ contained
|
||||||
|
|
||||||
syn match vimperatorAutoEventList "\(\a\+,\)*\a\+" contained contains=vimperatorAutoEvent
|
syn match vimperatorAutoEventList "\(\a\+,\)*\a\+" contained contains=vimperatorAutoEvent
|
||||||
|
|||||||
Reference in New Issue
Block a user