1$(() => { 2 let starsCount = $('.star.active').length; 3 let star = $('.rev-form__flex .rev-rat__item'); 4 let cStars = function (nowPos) { 5 6 // У вÑÐµÑ ÑбиÑаем active 7 star.removeClass('active'); 8 9 for (var i = 0; nowPos + 1 > i; i++) { 10 star.eq(i).toggleClass('active'); 11 } 12 13 $('#star_rating').val(nowPos + 1) 14 } 15 16 // ÐÑи наведении 17 /*star.hover(function () { 18 cStars($(this).index()); 19 });*/ 20 21 // ÐÑи клике 22 star.click(function () { 23 cStars($(this).index()); 24 // менÑем колиÑеÑÑво по ÐºÐ»Ð¸ÐºÑ 25 starsCount = $('.star.active').length; 26 }); 27 28 // Ðак ÑолÑко оÑводим мÑÑкÑ, возвÑаÑаем колиÑеÑÑво акÑивнÑÑ Ð°Ð¹Ñемов, коÑоÑÑе бÑли изнаÑалÑно 29 /*star.on('mouseleave', function () { 30 cStars(+starsCount - 1); 31 });*/ 32 33 const shopList = $('.shop_list'); 34 35 if (shopList.length > 0) { 36 $('.shop_list').select2({ 37 placeholder: "ÐÑбеÑиÑе магазин", 38 }); 39 $(".shop_list").select2("val", ""); 40 } 41 42 43 let fileInput = $('#input-file'); 44 let fileList = $('#file-list'); 45 46 // ÐбÑабоÑÑик Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ input[type="file"] 47 fileInput.on('change', function () { 48 // ÐолÑÑаем ÑпиÑок вÑбÑаннÑÑ Ñайлов 49 let files = fileInput.get(0).files; 50 51 // Создаем ÑпиÑок Ñайлов в HTML-ÑоÑмаÑе 52 let html = ''; 53 for (let i = 0; i < files.length; i++) { 54 html += `<div class="file">${files[i].name} <button class="remove-file" data-index="${i}">x</button></div>`; 55 } 56 57 // ÐобавлÑем ÑпиÑок Ñайлов в div 58 fileList.html(html); 59 60 // ÐбÑабоÑÑики Ð´Ð»Ñ ÐºÐ½Ð¾Ð¿Ð¾Ðº ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ñайлов 61 let removeButtons = $('.remove-file'); 62 removeButtons.on('click', function () { 63 let index = $(this).data('index'); 64 removeFile(files, index); 65 }); 66 }); 67 68 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ñайла из ÑпиÑка Ñайлов 69 function removeFile(files, index) { 70 let arr = Array.from(files); 71 arr.splice(index, 1); 72 73 let dataTransfer = new DataTransfer(); 74 75 arr.forEach(file => { 76 dataTransfer.items.add(file); 77 }); 78 79 fileInput.get(0).files = dataTransfer.files; 80 81 fileInput.trigger('change'); 82 } 83 84 $(document).on('click', '[data-js="trigger_file"]', function (e) { 85 e.preventDefault(); 86 fileInput.trigger('click'); 87 }) 88 89 $(document).on('submit', '[name="iblock_add"]', function (e) { 90 e.preventDefault(); 91 92 let formData = new FormData(this); 93 let _this = $(this); 94 _this.block({center: true}); 95 BX.ajax.runComponentAction('mk:reviews.add', 'send', { 96 mode: "class", 97 data: formData, 98 dataType: 'json', 99 }).then(function (response) { 100 _this.unblock(); 101 if (response.status === 'success') { 102 //$('[name="iblock_apply"]').attr('disabled', true); 103 var ee = setInterval(function () { 104 if (typeof window.ym != 'undefined') { 105 ym(7500958, 'reachGoal', 'form_success_feedback'); 106 clearInterval(ee); 107 } else { 108 console.log('ÐеÑÑика не иниÑиализиÑована'); 109 } 110 }, 500); 111 $('.rev-form__tit') 112 .text('ÐÑзÑв бÑÐ´ÐµÑ Ð¾Ð¿Ñбликован поÑле модеÑаÑии') 113 .addClass('added') 114 .removeClass('error') 115 } 116 }, function (response) { 117 _this.unblock(); 118 if (response.errors) { 119 let errorText = ''; 120 121 response.errors.forEach(function (error) { 122 errorText += error.message.replace(/<\/?[a-zA-Z]+>/gi, '') + '\n'; 123 }); 124 125 $('.rev-form__tit') 126 .text(errorText) 127 .addClass('error') 128 .removeClass('added') 129 } 130 }); 131 }) 132 133 $(document).on('click', '.rev-form__close', function () { 134 $(this).closest('[data-block="rev-form"]').css('display', 'none'); 135 $('[data-js="show-form"]').show(); 136 }) 137 138 $(document).on('click', '[data-js="show-form"]', function () { 139 $('[data-block="rev-form"]').css('display', 'block'); 140 $(this).hide(); 141 }) 142 143 144 const productInfo = $('#product-info'); 145 const inputProductID = $('[name="PRODUCT_ID"]'); 146 147 function clearInput($node) { 148 let textInput = 'Ð¢Ð¾Ð²Ð°Ñ (ÑкажиÑе код)' 149 $node 150 .attr('placeholder', textInput) 151 .attr('title', textInput) 152 .val('') 153 .removeClass('active') 154 } 155 156 $(document).on('keyup', '[name="FIND_PRODUCT"]', function () { 157 let _this = $(this), 158 code = _this.val(); 159 160 if (code.length > 3) { 161 BX.ajax.runComponentAction('mk:reviews.add', 'getProduct', { 162 mode: "class", 163 data: { 164 code: code 165 }, 166 dataType: 'json', 167 }).then(function (response) { 168 if (response.status === 'success') { 169 let data = response.data; 170 productInfo.html(` 171 <div data-js="select-product" data-id="${data.ID}"> 172 <img src="${data.PREVIEW_PICTURE}" alt=""> 173 <div class="title">${data.NAME}</div> 174 </div> 175 `); 176 177 /*$('[name="PRODUCT_ID"]').val(data.ID); 178 _this.attr('title', data.NAME);*/ 179 } 180 181 182 }, function (response) { 183 let errorText = ''; 184 inputProductID.val();
185 response.errors.forEach(function (error) { 186 errorText += error.message.replace(/<\/?[a-zA-Z]+>/gi, '') + '\n'; 187 }); 188 productInfo.html(` 189 <div> 190 <div class="title error">${errorText}</div> 191 </div> 192 `); 193 }); 194 } else { 195 productInfo.empty(); 196 inputProductID.val(); 197 } 198 }); 199 200 201 202 $(document).on('click', '[data-js="select-product"]', function () { 203 let _this = $(this); 204 205 inputProductID.val(_this.data('id')); 206 $('[name="FIND_PRODUCT"]') 207 .attr('placeholder', _this.find('div.title').text()) 208 .attr('title', _this.find('div.title').text()) 209 .val('') 210 .addClass('active') 211 212 /*$("[data-title]").tooltipster({ 213 animation: 'fade', 214 delay: 100, 215 theme: 'tooltipster-light', 216 touchDevices: false, 217 trigger: 'hover' 218 });*/ 219 }); 220 221 $(document).on('click', '.js-del', () => { 222 //$("[data-title]").tooltipster('destroy'); 223 clearInput( $('[name="FIND_PRODUCT"]')); 224 inputProductID.val(''); 225 productInfo.empty(); 226 }); 227 228 $(`[data-js="phone-mask"]`).mask("+7 (999) 999-99-99"); 229})
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.