From: Antonio Ospite Date: Fri, 23 Dec 2011 22:14:48 +0000 (+0100) Subject: Add an initCommand hook X-Git-Tag: 0.3~4 X-Git-Url: https://git.ao2.it/GM_direct_download_links.git/commitdiff_plain/f554502458ae33cf241386e89f9ec32b35915dba?ds=inline Add an initCommand hook Signed-off-by: Antonio Ospite --- 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); } }