1(function ($, Drupal, drupalSettings) { 2 var __products = $('.__resulats_search_products'); 3 let ajax_url = __products.data('url'); 4 5 var __docs = $('.__resulats_search_docs'); 6 let ajax_url_docs = __docs.data('url'); 7 8 $(document).ready(function () { 9 load_more(); 10 hide_load_more(); 11 display_good_list(); 12 }); 13 14 function display_good_list() { 15 $('.__search_button').on('click', function () { 16 if (!$(this).hasClass('active')) { 17 let type = $(this).attr('data-type'); 18 19 if (type == "Products") { 20 $(__docs).hide(); 21 $(__products).show(); 22 }else{ 23 $(__products).hide(); 24 $(__docs).show(); 25 } 26 27 $('.__search_button').toggleClass('active'); 28 } 29 }); 30 } 31 32 function load_more() { 33 $('.__load_more').on('click', function () { 34 let next = $('.__load_more').data('next'); 35 $.ajax({ 36 method: 'POST', 37 url: ajax_url, 38 dataType: "json", 39 data: { 40 page: Drupal.checkPlain(next) 41 } 42 }).done(function (data) { 43 let nb_pages_products = $('.__resulats_search_products').data('pages'); 44 45 $('.__resulats_search_products .__list_products').append(data.products); 46 $('.__load_more').data('next', data.next_page); 47 $('.__load_more').attr('data-next', data.next_page); 48 49 if (data.next_page == nb_pages_products) { 50 $('.__load_more').hide(); 51 } else { 52 $('.__load_more').show(); 53 } 54 }); 55 }); 56 57 $('.__load_more_doc').on('click', function () { 58 59 $.ajax({ 60 method: 'POST', 61 url: ajax_url_docs, 62 dataType: "json", 63 data: { 64 page: $('.__load_more_doc').data('next') 65 } 66 }).done(function (data) { 67 let nb_pages_docs = $('.__resulats_search_docs').data('pages'); 68 69 $('.__resulats_search_docs .__list_docs').append(data.docs); 70 $('.__load_more_doc').data('next', data.next_page); 71 $('.__load_more_doc').attr('data-next', data.next_page); 72 73 if (data.next_page == nb_pages_docs) { 74 $('.__load_more_doc').hide(); 75 } else { 76 $('.__load_more_doc').show(); 77 } 78 }); 79 }); 80 } 81 82 function hide_load_more() { 83 let nb_pages_products = $('.__resulats_search_products').data('pages'); 84 let nb_pages_docs = $('.__resulats_search_docs').data('pages'); 85 86 if (nb_pages_products > 1) { 87 $('.__load_more').show(); 88 } else { 89 $('.__load_more').hide(); 90 } 91 92 if (nb_pages_docs > 1) { 93 $('.__load_more_doc').show(); 94 } else { 95 $('.__load_more_doc').hide(); 96 } 97 } 98})(jQuery, Drupal, drupalSettings);
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.