1"use strict"; 2 3function woof_get_submit_link() { 4 5 //delete seo text 6 jQuery('.woof_seo_text').remove(); 7 8//filter woof_current_values values 9 if (woof_is_ajax) { 10 woof_current_values.page = woof_ajax_page_num; 11 } 12//+++ 13 if (Object.keys(woof_current_values).length > 0) { 14 jQuery.each(woof_current_values, function (index, value) { 15 if (index == swoof_search_slug) { 16 delete woof_current_values[index]; 17 } 18 if (index == 's') { 19 delete woof_current_values[index]; 20 } 21 if (index == 'product') { 22//for single product page (when no permalinks) 23 delete woof_current_values[index]; 24 } 25 if (index == 'really_curr_tax') { 26 delete woof_current_values[index]; 27 } 28 }); 29 } 30 //*** 31 if (Object.keys(woof_current_values).length === 0) { 32 if (woof_is_ajax) { 33 history.pushState({}, "", woof_current_page_link); 34 } 35 36 let tmp_url = woof_current_page_link.split('/' + swoof_search_slug + '/'); 37 38 return tmp_url[0]; 39 } 40 41 let hash = window.location.hash; 42 let vars = window.location.search; 43 let url = woof_current_page_link.replace(new RegExp(/page\/(\d+)\//), ""); 44 45 //remove pagination 46 let all_vars = new URLSearchParams(vars); 47 if (all_vars.has('product-page')) { 48 all_vars.delete('product-page'); 49 vars = "?" + all_vars; 50 } 51 52 if (!url) { 53 url = window.location.href;//fix when user changed form and want to test 54 } 55 56 let url_obj = new URL(url); 57 url = url_obj.origin + url_obj.pathname 58 59 let url_params = new URLSearchParams(url_obj.search); 60 61 let tmp_url = url.split('/' + swoof_search_slug + '/'); 62 let new_url = tmp_url[0]; 63 var link = ""; 64 if (new_url.slice(-1) != '/') { 65 new_url += '/'; 66 } 67 68 let url_array = []; 69 70 const ordered_data = Object.keys(woof_current_values).sort().reduce( 71 (obj, key) => { 72 obj[key] = woof_current_values[key]; 73 return obj; 74 }, {}); 75 76 for (let j in ordered_data) { 77 if (typeof url_parser_data.special[j] != 'undefined') { 78 url_array.push(url_parser_data.special[j]); 79 } else if (j == 'min_price' || 'max_price' == j) { 80 if (j == 'min_price') { 81 url_array.push('price-' + woof_current_values['min_price'] + '-to-' + woof_current_values['max_price']); 82 } 83 } else if (typeof url_parser_data.filters[j] != 'undefined') { 84 let request = woof_current_values[j] + ''; 85 request = request.replaceAll(',', '-and-'); 86 request = request.replaceAll('^', '-to-'); 87 request = request.replaceAll(/\s+/g, '+'); 88 url_array.push(url_parser_data.filters[j] + '-' + request); 89 } 90 91 92 } 93 94 let search_request_url = ""; 95 if (url_array.length) { 96 search_request_url = swoof_search_slug + '/' + url_array.join('/') + '/'; 97 } 98 99 if (url_params.size) { 100 let search_url_params = new URLSearchParams(vars); 101 102 let result_url_params = new URLSearchParams({ 103 ...Object.fromEntries(search_url_params), 104 ...Object.fromEntries(url_params) 105 }); 106 vars = "?" + result_url_params; 107 } 108 if (typeof woof_current_values['orderby'] != 'undefined') { 109 let searchParams = new URLSearchParams(vars); 110 111 if (searchParams.has('orderby')) { 112 searchParams.delete('orderby'); 113 } 114 searchParams.append("orderby", woof_current_values['orderby']); 115 vars = "?" + searchParams.toString(); 116 } 117 118 119 link = new_url + search_request_url + vars + hash 120 link = link.replace(new RegExp(/page\/(\d+)\//), ""); 121 if (woof_is_ajax) { 122 123 if (typeof woof_current_values.page != 'undefined' && woof_current_values.page > 1) { 124 link = new_url + search_request_url + 'page/' + woof_current_values.page + '/' + vars + hash 125 } 126 127 history.pushState({}, "", link); 128 129 } 130 return link; 131} 132
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.