From f554502458ae33cf241386e89f9ec32b35915dba Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Fri, 23 Dec 2011 23:14:48 +0100 Subject: [PATCH] Add an initCommand hook Signed-off-by: Antonio Ospite --- direct_download_links.user.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/direct_download_links.user.js b/direct_download_links.user.js index 6e4bbfd..fdf6ece 100644 --- a/direct_download_links.user.js +++ b/direct_download_links.user.js @@ -53,6 +53,12 @@ * * * Optional fields: + * + * initCommand: a function called before the regExp is matched, this can + * be useful in cases when some action needs to be done in + * order to make the element containing the regExp be actually + * rendered. It must accept a 'site' parameter. + * * onEvent: used to delay the urlRegexp matching to a certain event like * 'DOMNodeInserted' useful when the URL is added by some javascript * library. It has two fields: @@ -109,6 +115,9 @@ for (i = 0; i < supported_sites.length; i++) { var result = window.location.href.match(site.locationRegexp); if (result) { + if (site.initCommand) { + site.initCommand(site); + } direct_download_link_add(window.location.href, site); } } -- 2.1.4