diff --git a/templates/main.js b/templates/main.js index 8684e166..d7ae7fae 100755 --- a/templates/main.js +++ b/templates/main.js @@ -253,13 +253,28 @@ var postCaptchaId = null; function onCaptchaLoadHcaptcha() { if (captcha_renderer === null && (active_page === 'index' || active_page === 'catalog' || active_page === 'thread')) { let renderer = { + /** + * @returns {object} Opaque widget id. + */ applyOn: (container, params) => hcaptcha.render(container, { sitekey: "{{ config.hcaptcha_public }}", callback: params['on-success'], }), + /** + * @returns {void} + */ remove: (widgetId) => { /* Not supported */ }, + /** + * @returns {void} + */ reset: (widgetId) => hcaptcha.reset(widgetId), + /** + * @returns {bool} + */ hasResponse: (widgetId) => !!hcaptcha.getResponse(widgetId), + /** + * @returns {void} + */ execute: (widgetId) => hcaptcha.execute(widgetId) }; @@ -283,6 +298,9 @@ window.onCaptchaLoadTurnstile_post_thread = function() { function onCaptchaLoadTurnstile(action) { if (captcha_renderer === null && (active_page === 'index' || active_page === 'catalog' || active_page === 'thread')) { let renderer = { + /** + * @returns {object} Opaque widget id. + */ applyOn: function(container, params) { let widgetId = turnstile.render('#' + container, { sitekey: "{{ config.turnstile_public }}", @@ -294,9 +312,21 @@ function onCaptchaLoadTurnstile(action) { } return widgetId; }, + /** + * @returns {void} + */ remove: (widgetId) => turnstile.remove(widgetId), + /** + * @returns {void} + */ reset: (widgetId) => turnstile.reset(widgetId), + /** + * @returns {bool} + */ hasResponse: (widgetId) => !!turnstile.getResponse(widgetId), + /** + * @returns {void} + */ execute: (widgetId) => turnstile.execute(widgetId) };