1jQuery(document).ready(function() { 2 wpcf7_redirect_mailsent_handler(); 3}); 4 5function wpcf7_redirect_mailsent_handler() { 6 document.addEventListener( 'wpcf7mailsent', function( event ) { 7 form = wpcf7_redirect_forms [ event.detail.contactFormId ]; 8 9 // Script to run after sent. 10 if ( form.after_sent_script ) { 11 form.after_sent_script = htmlspecialchars_decode( form.after_sent_script ); 12 eval( form.after_sent_script ); 13 } 14 15 // Set redirect URL 16 if ( form.use_external_url && form.external_url ) { 17 redirect_url = form.external_url; 18 } else { 19 redirect_url = form.thankyou_page_url; 20 } 21 22 // Build http query 23 if ( form.http_build_query ) { 24 temp_http_query = jQuery.param( event.detail.inputs, true ); 25 http_query = temp_http_query.replace(new RegExp('\\+', 'g'), '%20'); 26 redirect_url = redirect_url + '?' + decodeURIComponent(http_query); 27 } else if ( form.http_build_query_selectively ) { 28 http_query = '?'; 29 selective_fields = form.http_build_query_selectively_fields.split(' ').join(''); 30 event.detail.inputs.forEach( function(element, index) { 31 if ( selective_fields.indexOf( element.name ) != -1 ) { 32 http_query += element.name + '=' + element.value + '&'; 33 } 34 }); 35 36 http_query = http_query.slice(0, -1); 37 redirect_url = redirect_url + decodeURIComponent(http_query); 38 } 39 40 // Redirect 41 if ( redirect_url ) {
42 if ( ! form.open_in_new_tab ) { 43 // Open in current tab 44 if ( form.delay_redirect ) { 45 setTimeout(function() { 46 location.href = redirect_url; 47 }, form.delay_redirect); 48 } else { 49 location.href = redirect_url; 50 } 51 } else { 52 // Open in external tab 53 if ( form.delay_redirect ) { 54 setTimeout(function() { 55 window.open( redirect_url ); 56 }, form.delay_redirect); 57 } else { 58 window.open( redirect_url ); 59 } 60 } 61 } 62 63 }, false ); 64} 65 66function htmlspecialchars_decode( string ) { 67 var map = { 68 '&': '&', 69 '&': "&", 70 '<': '<', 71 '>': '>', 72 '"': '"', 73 ''': "'", 74 '’': "â", 75 '‘': "â", 76 '–': "â", 77 '—': "â", 78 '…': "â¦", 79 '”': 'â' 80 }; 81 82 return string.replace(/\&[\w\d\#]{2,5}\;/g, function(m) { return map[m]; }); 83}
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.