1(function ($) { 2 "use strict"; 3 4 var redirection_enable = 'off'; 5 var redirection_url = ''; 6 var page_form_id =''; 7 var redirect_form_id =''; 8 var redirect_options =''; 9 10 document.addEventListener( 'wpcf7submit', function( event ) { 11 page_form_id = $(event.target).find('input[name="_wpcf7"]').eq(0).val(); 12 var get_options = $(event.target).find('input[name="_extcf7_redirect_options"]').eq(0).val(); 13 14 if(get_options){ 15 var option_values = JSON.parse(get_options); 16 redirect_form_id = option_values.form_id; 17 redirect_options = option_values.redirect_options; 18 if(redirect_options){ 19 redirection_enable = redirect_options.redirection_enable; 20 redirection_url = 'off' == redirect_options.custom_url_enable ? redirect_options.redirect_page : extcf7_get_custom_url( redirect_options.custom_urle ); 21 } 22 } 23 24 }, false ); 25 26 document.addEventListener('wpcf7mailsent', function (event) { 27 var redirect_delay = parseInt(extcf7_redirection_settings.redirection_delay); 28 29 setTimeout(function(){ 30 31 if( 'off' == redirection_enable && page_form_id == redirect_form_id ){ 32 return; 33 } 34 35 if('on' == redirect_options.js_action){ 36 if(redirect_options.javascript_code){ 37 eval(redirect_options.javascript_code); 38 } 39 } 40 41 if('off' == redirect_options.redirect_new_tab){ 42 window.location = redirection_url; 43 }else{ 44 window.open(redirection_url); 45 } 46 47 }, redirect_delay); 48 49 }, false); 50 51 function extcf7_get_custom_url(url){ 52 53 var url_input = /\[(.*?)\]/g.test(url); 54 55 if(!url_input){ 56 return url; 57 } 58 59 var redirect_url = ""; 60 var url_inputs = url.match(/\[(.*?)\]/g); 61 var url_inputs_names = []; 62 var i = 0; 63 64 url_inputs.forEach(function(item, index){ 65 url_inputs_names.push(item.replace("[", "").replace("]", "")); 66 }); 67 68 url_inputs_names.forEach(function(item, index){ 69 var inputs_val; 70 var inputs_tag = $(`[name="${item}"]`).get(0).tagName; 71 72 if(inputs_tag == 'INPUT'){ 73 var input_attr_type = $(`[name="${item}"]`).attr('type'); 74 if(input_attr_type == 'radio' || input_attr_type == 'checkbox'){ 75 inputs_val = $('input[name="'+item+'"]:checked').val(); 76 } else { 77 inputs_val = $('input[name="'+item+'"]').val(); 78 } 79 }else if(inputs_tag == 'SELECT'){ 80 inputs_val = $('select[name="'+item+'"] option').filter(':selected').val(); 81 } 82 83 redirect_url = url.replace( url_inputs[i], inputs_val ); 84 url = redirect_url; 85 i++; 86 }); 87 88 return url; 89 } 90 91})(jQuery);
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.