1$(function () { 2 $("main").addtocopy(); 3 let actualyInFavs; 4 $('body').on('click', '[data-wish]', function (e) { 5 e.preventDefault(); 6 var id = $(this).data('wish'); 7 var path = "/local/api/favorite.php"; 8 var btn = $(this); 9 if (apps.settings.auth) { 10 $.ajax({ 11 url: path, 12 type: "POST", 13 beforeSend: function () { 14 15 }, 16 data: {ID: id}, 17 success: function (data) { 18 if (data == "add") { 19 btn.attr('data-active', ''); 20 if (actualyInFavs > 0) { 21 actualyInFavs = actualyInFavs + 1; 22 } else { 23 actualyInFavs = parseInt(btn.closest('body').find('.ks_whishList').data('original-title').replace(/[^0-9]/g, '')) + 1; 24 } 25 $('.ks_whishList').attr('data-original-title', 'СпиÑок желаний - <b>' + actualyInFavs + '</b>').trigger("refresh"); 26 apps.settings.favs.push(id); 27 } else { 28 if (data == 'delete') { 29 btn.removeAttr('data-active'); 30 if (btn.hasClass('delete')) { 31 btn.parents('.col-sm-6').remove(); 32 } 33 apps.settings.favs = result; 34 } else if (data == 'notautorized') { 35 $('#ks_signInToogle .alert').show(); 36 $.fancybox.open({ 37 src: '#ks_Cabinet' 38 }); 39 40 } 41 } 42 refreshHeader(); 43 } 44 }); 45 } else { 46 $('#ks_signInToogle .alert').show(); 47 $.fancybox.open({ 48 src: '#ks_Cabinet' 49 }); 50// apps.settings.favs.push(id); 51// btn.attr('data-active', ''); 52 } 53 localStorage.setObject('apps', apps); 54 return false; 55 }) 56 $('body').on('click', '[data-buy]', function (e) { 57 e.preventDefault(); 58 var path = '/local/api/add.php', 59 id = $(this).data('buy'), 60 quantity = $(this).closest('.purchase').find('.quantity-num').val(); 61 $.ajax({ 62 url: path, 63 type: "POST", 64 beforeSend: function () { 65 66 }, 67 data: { 68 'id': id, 69 'qtu': quantity, 70 'LANGUAGE_ID': BX.message('LANGUAGE_ID'), 71 'siteId': BX.message('SITE_ID') 72 }, 73 success: function (res) { 74 console.log(res); 75 $('#ks_CartModal').html(res.data.modal); 76 $.fancybox.open({ 77 src: '#ks_CartModal', 78 type: 'inline', 79 smallBtn: true, 80 autoFocus: false 81 }); 82 $('.ks_shoppingCart--dropdown').html(res.data.basket); 83 refreshHeader(); 84 } 85 }) 86 }) 87 88 $('body').on('click', '[data-remove]', function (e) { 89 e.preventDefault(); 90 var path = '/local/api/remove.php', 91 id = $(this).data('remove'); 92 $.ajax({ 93 url: path, 94 type: "POST", 95 beforeSend: function () { 96 97 }, 98 data: {'id': id, 'LANGUAGE_ID': BX.message('LANGUAGE_ID'), 'siteId': BX.message('SITE_ID')}, 99 success: function (res) { 100 $('#ks_CartModal').html(res.data.modal); 101 $.fancybox.open({ 102 src: '#ks_CartModal', 103 type: 'inline', 104 smallBtn: true, 105 autoFocus: false 106 }); 107 $('.ks_shoppingCart--dropdown').html(res.data.basket); 108 refreshHeader(); 109 } 110 }) 111 }) 112 113 $('body').on('change', '.quantity-num', function (e) { 114 console.log($(this).val()); 115 }) 116 117 $('#footer_subscribe').on('submit', function () { 118 var url = '/local/api/subscribe.php'; 119 $.ajax({ 120 type: 'POST', 121 url: url, 122 data: $(this).serialize(), 123 dataType: 'json', 124 success: function (data) { 125 $('#footer_subscribe_feadback').html(data['mess']); 126 if (data.status == 'success') { 127 // braGA({'event': 'event-to-ga', 'eventCategory': 'ÐодпиÑка', 'eventAction': 'ФÑÑеÑ'}); 128 } 129 } 130 }); 131 return false;
132 }) 133 134 $('#auth').on('submit', function () { 135 var form = $(this); 136 grecaptcha.ready(function () { 137 grecaptcha.execute('6LcF1LUpAAAAANw2aTVfHUHn5eaIBEN7tce5DZNn', {action: 'submit'}).then(function (token) { 138 var data = form.serializeArray(); 139 data.push({name: "token", value: token}); 140 141 console.log(token) 142 console.log(data) 143 $('#valid-auth').prev().removeClass('is-invalid is-valid'); 144 $('#valid-auth').removeClass('invalid-feedback valid-feedback').html(''); 145 146 $.ajax({ 147 type: 'POST', 148 url: "/local/api/auth.php", 149 data: $.param(data), 150 success: function (msg) { 151 if (msg['error']) { 152 $('#valid-auth').prev().addClass('is-invalid'); 153 $('#valid-auth').addClass('invalid-feedback').html(msg['msg']); 154 } else { 155 $('#valid-auth').prev().addClass('is-valid'); 156 $('#valid-auth').addClass('valid-feedback').html(msg['msg']); 157 158 $('.ks_signIn').hide(); 159 $('.ks_signInPass').show(); 160 $('#ks_signInPassPhone').val($('#ks_signInPhone').val()); 161 } 162 } 163 }); 164 165 }); 166 }); 167 168 return false; 169 }); 170 $('#verify').on('submit', function () { 171 var data = $(this).serialize(); 172 $('#valid-verify').prev().removeClass('is-invalid is-valid'); 173 $('#valid-verify').removeClass('invalid-feedback valid-feedback').html(''); 174 175 $.ajax({ 176 type: 'GET', 177 url: "/local/api/auth.php", 178 data: data, 179 success: function (msg) { 180 if (msg['error']) { 181 $('#valid-verify').prev().addClass('is-invalid'); 182 $('#valid-verify').addClass('invalid-feedback').html(msg['msg']); 183 } else { 184 $('#valid-verify').prev().addClass('is-valid'); 185 $('#valid-verify').addClass('valid-feedback').html(msg['msg']); 186 location.reload(); 187 } 188 } 189 }); 190 return false; 191 }); 192 $('#registerForm').on('submit', function () { 193 var form = $(this); 194 grecaptcha.ready(function () { 195 grecaptcha.execute('6LcF1LUpAAAAANw2aTVfHUHn5eaIBEN7tce5DZNn', {action: 'submit'}).then(function (token) { 196 var data = form.serializeArray(); 197 data.push({name: "token", value: token}); 198 $('#valid-reg').prev().removeClass('is-invalid is-valid'); 199 $('#valid-reg').removeClass('invalid-feedback valid-feedback').html(''); 200 $.ajax({ 201 type: 'GET', 202 url: "/local/api/auth.php", 203 data: data, 204 success: function (msg) { 205 if (msg['error']) { 206 $('#valid-reg').prev().addClass('is-invalid'); 207 $('#valid-reg').addClass('invalid-feedback').html(msg['msg']); 208 } else { 209 $('#ks_registerToogle').hide(); 210 $('.ks_registerPass').show(); 211 $('.ks_registerPass .smsPass').focus(); 212 $('#ks_registerPhonePass').val($('#ks_registerPhone').val()); 213 //location.reload(); 214 } 215 } 216 }); 217 }); 218 }); 219 220 return false; 221 }); 222 $('#verify_reg').on('submit', function () { 223 var data = $(this).serialize(); 224 $('#valid-verify').prev().removeClass('is-invalid is-valid'); 225 $('#valid-verify').removeClass('invalid-feedback valid-feedback').html(''); 226 $.ajax({ 227 type: 'GET', 228 url: "/local/api/auth.php", 229 data: data, 230 success: function (msg) { 231 if (msg['error']) { 232 $('#valid-verify').prev().addClass('is-invalid'); 233 $('#valid-verify').addClass('invalid-feedback').html(msg['msg']); 234 } else { 235 location.reload(); 236 } 237 } 238 }); 239 return false;
240 }) 241}) 242 243function setQuantity(basketId, ratio, sign, bUseFloatQuantity) { 244 var curVal = parseFloat(BX("QUANTITY_INPUT_" + basketId).value), 245 newVal; 246 247 newVal = (sign == 'up') ? curVal + ratio : curVal - ratio; 248 249 if (newVal < 0) 250 newVal = 0; 251 252 if (bUseFloatQuantity) { 253 newVal = parseFloat(newVal).toFixed(4); 254 } 255 newVal = correctQuantity(newVal); 256 257 if (ratio > 0 && newVal < ratio) { 258 newVal = ratio; 259 } 260 261 if (!bUseFloatQuantity && newVal != newVal.toFixed(4)) { 262 newVal = parseFloat(newVal).toFixed(4); 263 } 264 265 newVal = correctQuantity(newVal); 266 267 BX("QUANTITY_INPUT_" + basketId).value = newVal; 268 BX("QUANTITY_INPUT_" + basketId).defaultValue = newVal; 269 270 BX('QUANTITY_INPUT_' + basketId).defaultValue = newVal; 271 BX("QUANTITY_INPUT_" + basketId).value = newVal; 272 // set hidden real quantity value (will be used in actual calculation) 273 BX("QUANTITY_" + basketId).value = newVal; 274 var quantity = BX('QUANTITY_' + basketId).value; 275 276 $.ajax({ 277 type: 'GET', 278 url: "/local/api/update.php", 279 data: {'id': basketId, 'quantity': quantity}, 280 success: function (res) { 281 console.log(res); 282 if ($('#sum_' + basketId)) { 283 $('#sum_' + basketId).html(res.sum_formated); 284 } 285 if ($('#PRICE_WITHOUT_DISCOUNT') && res.basket.price) { 286 $('#PRICE_WITHOUT_DISCOUNT').html(res.basket.price); 287 } 288 if ($('#allSum_FORMATED') && res.basket.sum) { 289 $('#allSum_FORMATED').html(res.basket.sum); 290 } 291 } 292 }); 293 294} 295 296function correctQuantity(quantity) { 297 return parseFloat((quantity * 1).toString()); 298} 299 300function refreshHeader() { 301 //tooltip 302 $('body').find('[data-toggle="tooltip"]').tooltip(); 303 304 $('body').find('[data-toggle-second="tooltip"]').tooltip({ 305 container: '.ks_shoppingCart--dropdown' 306 }); 307 $('body').removeClass('ks_shoppingCartOverlay'); 308 309 //scrollbar 310 var Scrollbar = window.Scrollbar; 311 Scrollbar.initAll({ 312 alwaysShowTracks: true 313 }); 314 console.log('haha'); 315} 316 317function removeFromBasket(id) { 318 var path = '/local/api/remove.php'; 319 $.ajax({ 320 url: path, 321 type: "POST", 322 beforeSend: function () { 323 324 }, 325 data: {'id': id, 'LANGUAGE_ID': BX.message('LANGUAGE_ID'), 'siteId': BX.message('SITE_ID')}, 326 success: function (res) { 327 $('.mini_basket_block_' + id).remove(); 328 console.log(res.sum); 329 console.log(res.sum > 0); 330 if (res.sum > 0) { 331 $('.mini_basket_block_sum_value').html(res.sum); 332 } else { 333 $('.mini_basket_block_sum').hide(); 334 $('.ks_shoppingCart--dropdown .cartAdd').hide(); 335 } 336 refreshHeader(); 337 } 338 }) 339} 340 341$.fn.addtocopy = function (usercopytxt) { 342 var options = { 343 htmlcopytxt: '<br><br>ÐодÑобнее: <a href="' + window.location.href + '">' + window.location.href + '</a><br>', 344 minlen: 25, 345 addcopyfirst: false 346 } 347 $.extend(options, usercopytxt); 348 var copy_sp = document.createElement('span'); 349 copy_sp.id = 'ctrlcopy'; 350 copy_sp.innerHTML = options.htmlcopytxt; 351 return this.each(function () { 352 $(this).mousedown(function () { 353 $('#ctrlcopy').remove(); 354 }); 355 $(this).mouseup(function () { 356 if (window.getSelection) { //good times 357 var slcted = window.getSelection(); 358 var seltxt = slcted.toString(); 359 if (!seltxt || seltxt.length < options.minlen) return; 360 var nslct = slcted.getRangeAt(0); 361 seltxt = nslct.cloneRange(); 362 seltxt.collapse(options.addcopyfirst); 363 seltxt.insertNode(copy_sp); 364 if (!options.addcopyfirst) nslct.setEndAfter(copy_sp); 365 slcted.removeAllRanges(); 366 slcted.addRange(nslct); 367 } else if (document.selection) { //bad times 368 var slcted = document.selection; 369 var nslct = slcted.createRange(); 370 var seltxt = nslct.text; 371 if (!seltxt || seltxt.length < options.minlen) return; 372 seltxt = nslct.duplicate(); 373 seltxt.collapse(options.addcopyfirst); 374 seltxt.pasteHTML(copy_sp.outerHTML); 375 if (!options.addcopyfirst) { 376 nslct.setEndPoint("EndToEnd", seltxt); 377 nslct.select(); 378 } 379 } 380 }); 381 }); 382};
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.