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 let url_obj = new URL(url); 53 url = url_obj.origin + url_obj.pathname 54 55 let url_params = new URLSearchParams(url_obj.search ); 56 57 let tmp_url = url.split('/' + swoof_search_slug + '/'); 58 let new_url = tmp_url[0]; 59 var link = ""; 60 if (new_url.slice(-1) != '/') { 61 new_url += '/'; 62 } 63 64 let url_array = []; 65 66 const ordered_data = Object.keys(woof_current_values).sort().reduce( 67 (obj, key) => { 68 obj[key] = woof_current_values[key]; 69 return obj; 70 }, {}); 71 72 for (let j in ordered_data) { 73 if (typeof url_parser_data.special[j] != 'undefined') { 74 url_array.push(url_parser_data.special[j]); 75 } else if (j == 'min_price' || 'max_price' == j) { 76 if (j == 'min_price') { 77 url_array.push('price-' + woof_current_values['min_price'] + '-to-' + woof_current_values['max_price']); 78 } 79 } else if (typeof url_parser_data.filters[j] != 'undefined') { 80 let request = woof_current_values[j] + ''; 81 request = request.replaceAll(',', '-and-'); 82 request = request.replaceAll('^', '-to-'); 83 request = request.replaceAll(/\s+/g, '+'); 84 url_array.push(url_parser_data.filters[j] + '-' + request); 85 } 86 87 88 } 89 90 let search_request_url = ""; 91 if (url_array.length) { 92 search_request_url = swoof_search_slug + '/' + url_array.join('/') + '/'; 93 } 94 95 if (url_params.size) { 96 let search_url_params = new URLSearchParams(vars); 97 98 let result_url_params = new URLSearchParams({ 99 ...Object.fromEntries(search_url_params), 100 ...Object.fromEntries(url_params) 101 }); 102 vars = "?" + result_url_params; 103 } 104 if(typeof woof_current_values['orderby'] != 'undefined'){ 105 let searchParams = new URLSearchParams(vars); 106 107 if (searchParams.has('orderby')) { 108 searchParams.delete('orderby'); 109 } 110 searchParams.append("orderby", woof_current_values['orderby']); 111 vars = "?" + searchParams.toString(); 112 } 113 114 115 link = new_url + search_request_url + vars + hash 116 link = link.replace(new RegExp(/page\/(\d+)\//), ""); 117 if (woof_is_ajax) { 118 119 if (typeof woof_current_values.page != 'undefined' && woof_current_values.page > 1) { 120 link = new_url + search_request_url + 'page/' + woof_current_values.page + '/' + vars + hash 121 } 122 123 history.pushState({}, "", link); 124 125 } 126 return link; 127} 128
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.