1function join(arr /*, separator */) { 2 var separator = arguments.length > 1 ? arguments[1] : ", "; 3 return arr.filter(function(n){return n}).join(separator); 4} 5 6function typeDescription(type) { 7 var TYPES = { 8 'INDIVIDUAL': 'Èíäèâèäóàëüíûé ïðåäïðèíèìàòåëü', 9 'LEGAL': 'Îðãàíèçàöèÿ' 10 } 11 return TYPES[type]; 12} 13 14 15 16function showSuggestion(suggestion) { 17 //console.log(suggestion); 18 var data = suggestion.data; 19 if (!data) 20 return; 21 22 var statusClass = data.type.toLowerCase(); 23 24 if (data.type == 'INDIVIDUAL' || data.type == 'LEGAL' ) { 25 if($('#lifestatus').val() == 'p') { 26 $('.personalRequest').show(); 27 $('input[name=personalRequest]').attr("checked", "checked"); 28 29 $('.' + statusClass).show(); 30 $('.' + statusClass).each(function () { 31 if ($(this).hasAttr('name')) $(this).attr('required', 'required'); 32 }); 33 } 34 } 35 36 $('input[name=personalRequest]').on('click', function(){ 37 if($(this).attr('checked') == 'checked') { 38 $(this).removeAttr('checked'); 39 $('.'+statusClass).hide(); 40 $('.'+statusClass).removeAttr('required'); 41 } else { 42 $(this).attr("checked", "checked"); 43 $('.'+statusClass).show(); 44 $('.'+statusClass).attr('required', 'required'); 45 } 46 }); 47 48 console.log(data); 49 50 $("#ogrn").val(data.ogrn); 51 $("#inn").val(data.inn); 52 53 $("#ogrn_p").val(data.ogrn); 54 $("#inn_p").val(data.inn); 55 $("#party2").val(data.name.full); 56 57 58 $("#hidden_inn").val(data.inn); 59 $("#kpp").val(data.kpp); 60 61 if (data.type == 'INDIVIDUAL') { 62 $("#party_header").val(data.name.full); 63 $("#party_header_status").val(data.name.full_with_opf); 64 } else { 65 if(data.management !== null) { 66 $("#party_header").val(data.management.name); 67 $("#party_header_status").val(data.management.post); 68 } 69 70 } 71 72 73 74 75 if (data.address) { 76 var address = ""; 77 if (data.address.data.qc == "0") { 78 address = join([data.address.data.postal_code, data.address.value]); 79 } else { 80 address = data.address.data.source; 81 } 82 $("#adres").val(address); 83 } 84} 85 86$("#party").suggestions({ 87 token: "f0c53199a85ab58d3f77933d5ed556ad6bfe9584", 88 type: "PARTY", 89 count: 5, 90 /* Âûçûâàåòñÿ, êîãäà ïîëüçîâàòåëü âûáèðàåò îäíó èç ïîäñêàçîê */ 91 onSelect: showSuggestion 92}); 93 94$("#party2").suggestions({ 95 token: "f0c53199a85ab58d3f77933d5ed556ad6bfe9584", 96 type: "PARTY", 97 count: 5, 98 /* Âûçûâàåòñÿ, êîãäà ïîëüçîâàòåëü âûáèðàåò îäíó èç ïîäñêàçîê */ 99 onSelect: showSuggestion 100});
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.