1$(document).ready(function() { 2 $('.load_ai_tool').click(function(e) { 3 $(".full-loader").css('display','block'); 4 $('#startPageSidebarDropdown').click(); 5 var selected_cat_name = $(this).text(); 6 $('#startPageSidebarDropdown').html(selected_cat_name+'<span class="start-page__sidebar-dropdown-icon"><i class="fas fa-chevron-down"></i></span>'); 7 //$window.scrollTop(); 8 var id = $(this).data('id'); 9 var cat_id = $(this).data('cat-id'); 10 $('#sub_cat_id').val(id); 11 $('#cat_id').val(cat_id); 12 $('.load_ai_tool').removeClass('active'); 13 //$('.nav-link').removeClass('active'); 14 $(this).addClass('active'); 15 e.stopPropagation(); 16 // Toggle dropdown if not already visible: 17 if ($('#'+cat_id).find('.dropdown-menu').is(":hidden")){ 18 $('#'+cat_id).find('.dropdown-toggle').dropdown('toggle'); 19 } 20 $.ajax({ 21 url: "/category-ai-tools", 22 type: "GET", 23 data: { 24 id: id, 25 cat_id:cat_id 26 }, 27 success: function(response) { 28 if (response.success) { 29 if (response.code == 200) { 30 $('.ai-tool__listing').html(response.html); 31 } 32 } else { 33 if (response.code == 202) { 34 $('.ai-tool__listing').html('<h3>' + response.message + '</h3>'); 35 } 36 } 37 }, 38 }); 39 $(".full-loader").css('display','none'); 40 }) 41 42 $('#tool-sub-categories').select2({ 43 width: '100%', 44 placeholder: "Selecteer sub categorie", 45 dropdownParent: $('#submitToolModal'), 46 }); 47 $('#tool-labels').select2({ 48 width: '100%', 49 placeholder: "Selecteer labels", 50 dropdownParent: $('#submitToolModal'), 51 }); 52 53 if ($(window).width() < 992) { 54 $('#startPageSidebarDropdown').click(function() { 55 $('#startPageSidebarCategory').slideToggle(); 56 }); 57 } 58 59 $('#tool-photo').change(function() { 60 const file = this.files[0]; 61 if (file) { 62 let reader = new FileReader(); 63 reader.onload = function(event) { 64 $('#tool-image').attr('src', event.target.result); 65 } 66 reader.readAsDataURL(file); 67 } 68 }); 69 70 //Add classes to sidebar on scroll when touch to top 71 72 /*var sidebarStartPage = $('.start-page__sidebar').offset(); 73 var curWinWidth = $(window).width(); 74 var curWinHeight = $(window).height(); 75 var $window = $(window); 76 77 $window.scroll(function() { 78 var scroll = $window.scrollTop(); 79 if ($('.start-page__sidebar').length) { 80 if ($window.scrollTop() >= sidebarStartPage.top + 100) { 81 $("body").addClass("start-page__sidebar__touch"); 82 } else { 83 ($window.scrollTop() <= sidebarStartPage.top + 100) 84 $("body").removeClass("start-page__sidebar__touch"); 85 } 86 } 87 });*/ 88 89 $('#main_category').change(function(){ 90 var value = $(this).val(); 91 $.ajax({ 92 type: 'post', 93 url: '/get-sub-category', 94 data : { cat_id : value }, 95 beforeSend: function(){ 96 console.log('Hello beforeSend'); 97 }, 98 success: function(response){ 99 $('#select-option').html(response.html); 100 $('#tool-sub-categories').select2({ 101 maximumSelectionLength: 5, 102 placeholder: "Selecteer sub categorie" 103 }); 104 }, 105 complete(response){ 106 console.log('Hello complete'); 107 }, 108 }) 109 }); 110 111 $(document).on('submit','#tool-request-form', function(e) { 112 $(".full-loader").show(); 113 e.preventDefault(); 114 var form = $(this); 115 form.find(".form-error__message").html(''); 116 var endPoint = form.attr('action'); 117 var method = form.attr('method'); 118 //var values = form.serialize(); 119 var values = new FormData(this); 120 $.ajax({ 121 type: method, 122 url: endPoint, 123 data: values, // serializes the form's elements. 124 processData: false, 125 contentType: false, 126 beforeSend: function(){ 127 form.find('#tool_submit_button').prop('disabled', true); 128 }, 129 success: function(response){ 130 if(response.success){ 131 form.trigger('reset'); 132 form.find('.ai_tool_name').val(''); 133 form.find('.ai_tool_tool_email').val(''); 134 form.find('.ai_tool_url').val(''); 135 form.find('.ai_tool_category').val(''); 136 form.find('.ai_tool_sub_category').val(''); 137 toastr.success(response.message,{timeOut: 3000}); 138 location.reload(); 139 }else{ 140 if(response.status_code == '419'){ 141 location.reload(); 142 } 143 } 144 }, 145 error: function(xhr) { 146 var errors = xhr.responseJSON.errors; 147 $.each(errors, function(key, value) { 148 if(key == 'sub_category.0' || key == 'sub_category'){ 149 var inputGroup = $('#tool-sub-categories').closest('.form-group'); 150 }else{ 151 var inputGroup = $('.ai_tool_' + key).closest('.form-group'); 152 } 153 inputGroup.find('.form-error__message').html(value); 154 form.find(".form-error__message").show().delay(5000).fadeOut(1500); 155 }); 156 },
157 complete(response){ 158 $(".full-loader").hide(); 159 form.find('#tool_submit_button').prop('disabled', false); 160 } 161 162 }); 163 }); 164 165 166}); 167$(document).on('click','.ai-tools-label',function() { 168//$('.ai-tools-label').click(function(e) { 169 var label_id = $(this).data('id'); 170 var sub_cat_id = $('#sub_cat_id').val(); 171 var cat_id = $('#cat_id').val(); 172 $.ajax({ 173 url: "/category-ai-tools", 174 type: "GET", 175 data: { 176 id: sub_cat_id, 177 cat_id:cat_id, 178 label_id:label_id 179 }, 180 success: function(response) { 181 if (response.success) { 182 if (response.code == 200) { 183 $('.ai-tool__listing').html(response.html); 184 } 185 } else { 186 if (response.code == 202) { 187 $('.ai-tool__listing').html('<h3>' + response.message + '</h3>'); 188 } 189 } 190 }, 191 }); 192})
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.