PluginProbe ʕ •ᴥ•ʔ
reCaptcha by BestWebSoft / 1.20
reCaptcha by BestWebSoft v1.20
1.79 1.80 1.82 1.83 1.84 1.85 1.86 1.87 trunk 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.30 1.31 1.32 1.33 1.34 1.35 1.36 1.37 1.38 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.50 1.51 1.52 1.53 1.54 1.55 1.56 1.57 1.58 1.59 1.60 1.61 1.62 1.63 1.64 1.65 1.66 1.67 1.68 1.70 1.71 1.72 1.73 1.74 1.75 1.78
google-captcha / js / script.js
google-captcha / js Last commit date
admin_script.js 10 years ago script.js 10 years ago
script.js
100 lines
1 (function( $ ) {
2 $( document ).ready(function() {
3
4 if ( parseFloat( $.fn.jquery ) >= 1.7 ) {
5 $( '#recaptcha_widget_div' ).on( 'input paste change', '#recaptcha_response_field', cleanError );
6 } else {
7 $( '#recaptcha_widget_div #recaptcha_response_field' ).live( 'input paste change', cleanError );
8 }
9
10 $( 'form' ).not( '[name="loginform"], [name="registerform"], [name="lostpasswordform"]' ).submit( function( e ) {
11 var $form = $( this ),
12 $gglcptch = $form.find( '.gglcptch' ),
13 $captcha = $form.find( '#recaptcha_widget_div:visible' ),
14 $captcha_v2 = $form.find( '.g-recaptcha:visible' );
15 if ( $captcha.length ) {
16 if ( $gglcptch.find( 'input[name="gglcptch_test_enable_js_field"]:hidden' ).length == 0 ) {
17 $gglcptch.append( '<input type="hidden" value="' + gglcptch_vars.nonce + '" name="gglcptch_test_enable_js_field" />' );
18 }
19 $.ajax({
20 async : false,
21 cache : false,
22 type : 'POST',
23 url : ajaxurl,
24 headers : {
25 'Content-Type' : 'application/x-www-form-urlencoded'
26 },
27 data : {
28 action: 'gglcptch_captcha_check',
29 recaptcha_challenge_field : $( '#recaptcha_challenge_field' ).val(),
30 recaptcha_response_field : $( '#recaptcha_response_field' ).val()
31 },
32 success: function( data ) {
33 if ( data == 'error' ) {
34 if ( $captcha.next( '#gglcptch_error' ).length == 0 ) {
35 $captcha.after( '<label id="gglcptch_error">' + gglcptch_error_msg + '</label>' );
36 }
37 $( '#recaptcha_reload' ).trigger( 'click' );
38 e.preventDefault ? e.preventDefault() : (e.returnValue = false);
39 return false;
40 }
41 },
42 error: function( request, status, error ) {
43 if ( $captcha.next( '#gglcptch_error' ).length == 0 ) {
44 $captcha.after( '<label id="gglcptch_error">' + request.status + ' ' + error + '</label>' );
45 }
46 $( '#recaptcha_reload' ).trigger( 'click' );
47 e.preventDefault ? e.preventDefault() : (e.returnValue = false);
48 return false;
49 }
50 });
51 $( '#recaptcha_reload' ).trigger( 'click' );
52 } else if ( $captcha_v2.length ) {
53 if ( $gglcptch.find( 'input[name="gglcptch_test_enable_js_field"]:hidden' ).length == 0 ) {
54 $gglcptch.append( '<input type="hidden" value="' + gglcptch_vars.nonce + '" name="gglcptch_test_enable_js_field" />' );
55 }
56 $.ajax({
57 async : false,
58 cache : false,
59 type : 'POST',
60 url : ajaxurl,
61 headers : {
62 'Content-Type' : 'application/x-www-form-urlencoded'
63 },
64 data : {
65 action: 'gglcptch_captcha_check',
66 'g-recaptcha-response' : $form.find( '.g-recaptcha-response' ).val()
67 },
68 success: function( data ) {
69 if ( data == 'error' ) {
70 if ( $captcha_v2.next( '#gglcptch_error' ).length == 0 ) {
71 $captcha_v2.after( '<label id="gglcptch_error">' + gglcptch_error_msg + '</label>' );
72 $( "#gglcptch_error" ).fadeOut( 4000, function() {
73 $( "#gglcptch_error" ).remove();
74 });
75 $( 'html, body' ).animate({ scrollTop: $captcha_v2.offset().top - 50 }, 500);
76 }
77 e.preventDefault ? e.preventDefault() : (e.returnValue = false);
78 return false;
79 }
80 },
81 error: function( request, status, error ) {
82 if ( $captcha_v2.next( '#gglcptch_error' ).length == 0 ) {
83 $captcha_v2.after( '<label id="gglcptch_error">' + request.status + ' ' + error + '</label>' );
84 }
85 e.preventDefault ? e.preventDefault() : (e.returnValue = false);
86 return false;
87 }
88 });
89 }
90 });
91 });
92
93 function cleanError() {
94 $error = $( this ).parents( '#recaptcha_widget_div' ).next( '#gglcptch_error' );
95 if ( $error.length ) {
96 $error.remove();
97 }
98 }
99
100 })(jQuery);