1 2 3$.widget('custom.catcomplete', $.ui.autocomplete, { 4 _create: function() { 5 this._super(); 6 this.widget().menu('option', 'items', '> :not(.ui-autocomplete-category)'); 7 }, 8 _renderMenu: function(ul, items) { 9 var that = this, 10 currentCategory = ''; 11 $.each(items, function(index, item) { 12 $.each(item, function(index2, row) { 13 var li; 14 if (row.category != currentCategory) { 15 ul.append('<li class="ui-autocomplete-category">' + row.category + '</li>'); 16 currentCategory = row.category; 17 } 18 li = that._renderItemData(ul, row); 19 if (row.category) { 20 li.attr('aria-label', row.category + ' : ' + row.label); 21 } 22 }); 23 }); 24 } 25}); 26 27$(function(){ 28 $('input[name=search]').each(function(){ 29 var input = $(this); 30 31 var sccode = input.data('sccode'); 32 if (!sccode) return; 33 34 var open = null; 35 if(navigator.userAgent.indexOf('iPhone') > 0 || navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0){ 36 open = function(event, ui) { 37 $('.ui-autocomplete').off('menufocus hover mouseover mouseenter'); 38 } 39 } 40 //è¨èªåå¾ 41 var language = languageChange(); 42 43 //URLé£çµ 44 var url = "https://mitsuifudosan.search.zetacx.net/api/search/suggest?callback=?"; 45 46 input.catcomplete({ 47 source: function(request, response){ 48 $.ajax({
49 url: url, 50 dataType: "jsonp", 51 data: { 52 sccode: sccode, 53 code:"rsc", 54 language: language, 55 limit: 65, 56 keyword : request.term, 57 58 }, 59 success: function(jsondata){ 60 response(jsondata); 61 62 if (Object.keys(jsondata).length) { 63 let ipWith = input.outerWidth(); 64 let ipLeft = $('#JS_search').offset().left; 65 let ipTop = $('#JS_search').offset().top; 66 $('#renewal2022 .ui-autocomplete').css({"width":(ipWith * 92)/100, "display":"block","left":ipLeft + (ipWith * 4)/100 ,"top":ipTop+2}); 67 } 68 } 69 }); 70 }, 71 minLength: 2, 72 select: function( event, ui ) { 73 if (!ui.item) return; 74 location.href = ui.item.url; 75 }, 76 open: open 77 }); 78 }); 79}); 80 81$('#shopSearchFreewordButton').click(function(){ 82 83 var value = $('#shopSearchFreeword').val(); 84 85 value = value.trim(); 86 value = value.substring(0, 100); 87 88 $('#shopSearchFreeword').val(value); 89 90 //è¨èªåå¾ 91 $("#lng").val(languageChange()); 92 93 $(this).closest('form').submit(); 94 95}) 96 97$('#shopSearchCategoryButton').click(function(){ 98 var values = []; 99 100 $('input:checkbox[name="categorySelect"]:checked').each(function() { 101 values.push($(this).val()); 102 }); 103 104 $('#category').val(values.join('|')); 105 106 $(this).closest('form').submit(); 107 108}) 109function languageChange() { 110 // è¨èªåå¾ 111 var language = "j"; 112 var newLanguage = location.pathname.split('/')[1]; 113 switch (newLanguage) { 114 case 'en': 115 language = "e"; 116 break; 117 case 'cn': 118 language = "c"; 119 break; 120 case 'tw': 121 language = "t"; 122 break; 123 case 'ko': 124 language = "k"; 125 break; 126 case 'pt': 127 language = "p"; 128 break; 129 } 130 return language; 131} 132 133
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.