PageSourceSearch

https://www.intelligent-imaging.com/wp-content/plugins/wpcf7-recap…/js/wpcf7-recaptcha-controls.js?ver=1.2

js intelligent-imaging.com collected 2026-09-25 23:42:33 UTC 2,000 bytes, 65 lines download raw bytes

1( function() {
2	
3	let recaptchaWidgets = [];
4	recaptchaCallback = function() {
5		
6		let forms = document.getElementsByTagName( 'form' );
7		let pattern = /(^|\s)g-recaptcha(\s|$)/;
8
9		for ( let i = 0; i < forms.length; i++ ) {
10			let recaptchas = forms[ i ].getElementsByClassName( 'wpcf7-recaptcha' );
11			
12			for ( let j = 0; j < recaptchas.length; j++ ) {
13				let sitekey = recaptchas[ j ].getAttribute( 'data-sitekey' );
14
15				if ( recaptchas[ j ].className && recaptchas[ j ].className.match( pattern ) && sitekey ) {
16					let params = {
17						'sitekey': sitekey,
18						'type': recaptchas[ j ].getAttribute( 'data-type' ),
19						'size': recaptchas[ j ].getAttribute( 'data-size' ),
20						'theme': recaptchas[ j ].getAttribute( 'data-theme' ),
21						'align': recaptchas[ j ].getAttribute( 'data-align' ),
22						'badge': recaptchas[ j ].getAttribute( 'data-badge' ),
23						'tabindex': recaptchas[ j ].getAttribute( 'data-tabindex' )
24					};
25
26					let callback = recaptchas[ j ].getAttribute( 'data-callback' );
27
28					if ( callback && 'function' == typeof window[ callback ] ) {
29						params[ 'callback' ] = window[ callback ];
30					}
31
32					let expired_callback = recaptchas[ j ].getAttribute( 'data-expired-callback' );
33
34					if ( expired_callback && 'function' == typeof window[ expired_callback ] ) {
35						params[ 'expired-callback' ] = window[ expired_callback ];
36					}
37
38					let widget_id = grecaptcha.render( recaptchas[ j ], params );
39					recaptchaWidgets.push( widget_id );
40					break;
41				}
42			}
43		}
44	};
45
46	/**
47	 * Reset the reCaptcha when Contact Form 7 gives us:
48	 *  - Spam
49	 *  - Success
50	 *  - Fail
51	 * 
52	 * @return void
53	 */
54	document.addEventListener( 'wpcf7submit', function( event ) {
55		switch ( event.detail.status ) {
56			case 'spam':
57			case 'mail_sent':
58			case 'mail_failed':
59				for ( let i = 0; i < recaptchaWidgets.length; i++ ) {
60					grecaptcha.reset( recaptchaWidgets[ i ] );
61				}
62		}
63	}, false );
64	
65} )();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.