1productListForKeywordArea = []; 2 3jQuery("#keyword_search").click(async function() { 4 getProductByKeyword(jQuery("#keyword_search_text").val()); 5}); 6 7function getProductByKeyword(keyword) { 8 var sendData = new Object(); 9 sendData.keyword = keyword; 10 11 jQuery.post(pluginUrl + '/api/get_product_by_keyword.php', sendData) 12 .done(async function(response) { 13 // jQuery("#product_refresh_block_in_application_tab").hide(); 14 jQuery("#product_refresh_block_in_application").hide(); 15 jQuery("#product_refresh_block").empty(); 16 jQuery("#product_block_by_category").hide(); 17 jQuery("#product_block_by_application").hide(); 18 jQuery("#filter_list").empty(); 19 jQuery("#filter_list_in_application").empty(); 20 21 categoryName = await getCategoryName(); 22 console.log(categoryName); 23 24 productListByKeyword = response; 25 console.log('productListByKeyword:'); 26 console.log(productListByKeyword); 27 28 var firstMatchingFlag = false; 29 var firstMatchingCategory = ''; 30 31 jQuery(".product_counts_in_application").each(function() { 32 jQuery(this).text('0'); 33 }); 34 35 if (Object.keys(productListByKeyword).length > 0) { 36 jQuery.each(productListByKeyword, function(index, subCategory) { 37 var productCounts = 0; 38 jQuery.each(subCategory, function(index, productList) { 39 //console.log(productList.length); 40 productCounts = productCounts + productList.length; 41 }); 42 43 var firstFloorCategoryId = index.split('category_')[1]; 44 var target_id = 'category_tab_in_application_' + firstFloorCategoryId; 45 46 jQuery(".category_tab_in_application").each(function() { 47 var id = jQuery(this).attr('id'); 48 if (firstMatchingFlag == false && id == target_id) { 49 firstMatchingCategory = id; 50 firstMatchingFlag = true; 51 } 52 jQuery(this).removeClass('active'); 53 }); 54 55 jQuery("#product_counts_in_application_" + firstFloorCategoryId).text(productCounts); 56 }); 57 58 jQuery("#" + firstMatchingCategory).addClass('active'); 59 categoryNow = firstMatchingCategory.split('category_tab_in_application_')[1]; 60 61 var keywordMode = true; 62 await showProductInApplication(keywordMode); 63 jQuery("#product_block_by_application").show(); 64 65 jQuery(".category_tab_in_application").unbind().click(function() { 66 jQuery(".category_tab_in_application").each(function() { 67 jQuery(this).removeClass('active'); 68 }); 69 jQuery(this).addClass('active'); 70 categoryNow = jQuery(this).attr('id').split('category_tab_in_application_')[1]; 71 var keywordMode = true; 72 showProductInApplication(keywordMode); 73 }); 74 } else { 75 jQuery("#filter_list").empty(); 76 jQuery("#filter_list_in_application").empty(); 77 jQuery(".category_tab_in_application").each(function() { 78 jQuery(this).removeClass('active'); 79 }); 80 jQuery("#product_block_by_application").show(); 81 noInformation('product_refresh_block_in_application'); 82 } 83 }).fail(function() { 84 console.log("fail to get_product_by_keyword"); 85 }) 86} 87 88//inputè¼¸å ¥æåå³éåkeywordæ¬ 89jQuery("#keyword_search_text").keyup(function(event) { 90 if (jQuery("#keyword_search_text").val().length >= 3) { 91 openUpKeywordArea() 92 } 93 94 if (jQuery("#keyword_search_text").val().length < 3 && jQuery(".keyword-box").hasClass('active')) { 95 jQuery(".keyword-box").removeClass('active') 96 } 97}) 98 99//黿inputè¦éæ°æékeywordæ¬ 100jQuery("#keyword_search_text").click(function() { 101 if (jQuery("#keyword_search_text").val().length >= 3) { 102 openUpKeywordArea() 103 } 104}) 105 106async function openUpKeywordArea() { 107 productListForKeywordArea = await getProductListByKeyword(); 108 console.log('productListForKeywordArea', productListForKeywordArea); 109 jQuery("#keyword-area").empty() 110 if (jQuery("#keyword_search_text").val().length >= 3 && productListForKeywordArea.length > 0) { 111 var productNameListForKeywordArea = ''; 112 productListForKeywordArea.forEach(function(eachProduct) { 113 productNameListForKeywordArea += '<li>' + eachProduct.name + '</li>'; 114 }) 115 116 jQuery("#keyword-area").append(productNameListForKeywordArea); 117 if (!jQuery(".keyword-box").hasClass('active')) { 118 jQuery(".keyword-box").addClass('active') 119 } 120
121 //黿keywordæ¬å §é¸é ï¼æå¼å¸¶å ¥input 122 jQuery(".keyword-box li").unbind().click(function() { 123 var targetText = jQuery(this).text() 124 console.log(targetText) 125 jQuery(".keyword-box").removeClass('active') 126 jQuery("#keyword_search_text").val(targetText) 127 }) 128 129 //æ»é¼ é¢ékeywordæ¬å³éé 130 jQuery(".wk-product-filter-box .right-box").mouseleave(function() { 131 jQuery(".keyword-box").removeClass('active') 132 }) 133 } 134} 135 136function getProductListByKeyword() { 137 var sendData = new Object(); 138 sendData.keyword = jQuery("#keyword_search_text").val(); 139 sendData.data_process = false; 140 141 return jQuery.post(pluginUrl + '/api/get_product_by_keyword.php', sendData); 142}
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.