diff --git a/images/refresh.png b/images/refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..77e12d1c6acb7ad8defd5410e695d603097fba04 GIT binary patch literal 800 zcmV+*1K<3KP);XHLv^X{MWe`Tlinj{a@#N-#PzxnA+M}IA}100Yb>4X_(gy!}zoRE}P9-Gcn=d zkLP%hWjQ4)@@JM~+i8G(XAfenZNtG5HYNzd8%dOYyWMWnOnF3+72tRd!jUi}2NK|K@I&8)OF&qx6p4}p zNk|SR-ebsy13*!0YHDW7YT0sZYHEb3naQ_!H+||v`?BIuOy6N2+`4@WqS457TO^h) zm&>rVwN(K?sZ?EUrDdq93cY>3t8LL(cd1me(hdXzFq59yt*$=OA8Cm$X{rYHyV)7A z#X?cQ`YiyT&v&O(EP<};pb-roKY8>C?|NIBLs@#ZUja+Twe?j%i2xe~G);pCbMras zNLeT#2A>Qz9?$BUE+N?{W;%*H`IOjtzBJ zbcqY1Brc%;m;*rB&UK$%qceTbLcVYjRapQA4pnLuP|^uxzK1(Rn)UJR(iAxgof;y1uelRaG_g>g8*| zAi&Pe?eA0t^n1W zX4Kl&3PZywBhVa}N1wF+SVMXH*LDTK>)l&an7)3`#Be)-7DtoN3TR7cbNHakwn95Q eJ67C30R{j{$`Q#a2a=)y0000download this verification to listen on your device.', array( '@captcha-url' => $captcha_url, )); +$refresh_alt = t('Refresh'); + +$refresh_image_output = theme('image', drupal_get_path('module', 'mollom') . '/images/refresh.png', $refresh_alt, NULL, NULL, FALSE); ?> -
-
+ + +
+
- - + + - -
-
- -
+ +
+
+ +
- - + + -
.
-
+
.
+
+ diff --git a/mollom.captcha.image.tpl.php b/mollom.captcha.image.tpl.php index 9ec62e9..e31e64b 100644 --- a/mollom.captcha.image.tpl.php +++ b/mollom.captcha.image.tpl.php @@ -12,10 +12,15 @@ $switch_verify = $audio_enabled ? t('Switch to audio verification') : ''; $instructions = t("Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive."); $image_alt_text = t('Type the characters you see in this picture.'); +$refresh_alt = t('Refresh'); ?> - -
  .
+ + + +
  .
+
diff --git a/mollom.css b/mollom.css index 6072398..e7d16dd 100644 --- a/mollom.css +++ b/mollom.css @@ -25,3 +25,16 @@ img.mollom-fba { .mollom_captcha_flash_player:focus{ border: yellow 2px solid; } + +/* Refresh CAPTCHA icon */ +.mollom-captcha-container { + display: inline-block; + position: relative; +} + +.mollom-captcha-container .mollom-refresh-captcha { + position: absolute; +} +.mollom-captcha-container .mollom-captcha-content { + padding-left: 20px; +} diff --git a/mollom.js b/mollom.js index cec9992..e13d9a1 100644 --- a/mollom.js +++ b/mollom.js @@ -1,5 +1,6 @@ (function ($) { +Drupal.mollom = Drupal.mollom || {}; /** * Open links to Mollom.com in a new window. * @@ -15,23 +16,32 @@ Drupal.behaviors.mollomTarget = function (context) { * Attach click event handlers for CAPTCHA links. */ Drupal.behaviors.mollomCaptcha = function (context) { - $('a.mollom-switch-captcha', context).click(getMollomCaptcha); + $('a.mollom-switch-captcha', context).click(function (e) { + var $mollomForm = $(this).parents('form'); + var newCaptchaType = $(this).hasClass('mollom-audio-captcha') ? 'audio' : 'image'; + Drupal.mollom.getMollomCaptcha(newCaptchaType, $mollomForm); + }); + $('a.mollom-refresh-captcha', context).click(function(e) { + var $mollomForm = $(this).parents('form'); + var currentCaptchaType = $(this).hasClass('mollom-refresh-audio') ? 'audio' : 'image'; + Drupal.mollom.getMollomCaptcha(currentCaptchaType, $mollomForm); + }) }; /** * Fetch a Mollom CAPTCHA and output the image or audio into the form. + * + * @param captchaType + * The type of CAPTCHA to retrieve; one of "audio" or "image". + * @param context + * The form context for its retrieval. */ -function getMollomCaptcha() { - // Get the current requested CAPTCHA type from the clicked link. - var newCaptchaType = $(this).hasClass('mollom-audio-captcha') ? 'audio' : 'image'; - - var context = $(this).parents('form'); - +Drupal.mollom.getMollomCaptcha = function (captchaType, context) { // Extract the form build ID and Mollom content ID from the form. var formBuildId = $('input[name="mollom[mollom_build_id]"]', context).val(); var mollomContentId = $('input.mollom-content-id', context).val(); - var path = 'mollom/captcha/' + newCaptchaType + '/' + formBuildId; + var path = 'mollom/captcha/' + captchaType + '/' + formBuildId; if (mollomContentId) { path += '/' + mollomContentId; } @@ -52,7 +62,7 @@ function getMollomCaptcha() { // Add an onclick-event handler for the new link. Drupal.attachBehaviors(context); // Focus on the CAPTCHA input. - if (newCaptchaType == 'image') { + if (captchaType == 'image') { $('input[name="mollom[captcha]"]', context).focus(); } else { // Focus on audio player.