1"use strict"; 2 3//ÐбÑабоÑка ÑобÑÑие клик по ÑоваÑÑ 4$(document).ready(function () { 5 6 function bypassingHearts(data, hide = false) { 7 $(".wishlist-list-button").each(function (index) { 8 let productId = $(this).attr('data-product-id'); 9 let hasClass = $(this).hasClass('wishlist-list-active-button'); 10 11 //ÐÑÑÑ ÐºÐ»Ð°ÑÑ Ð½Ð¾ не Ð²Ñ Ð¾Ð´Ð¸Ñ ÐÐРклаÑÑа Ð½ÐµÑ Ð½Ð¾ в маÑÑив Ð²Ñ Ð¾Ð´Ð¸Ñ 12 if (hasClass && !data.products.includes(productId) || 13 !hasClass && data.products.includes(productId) 14 ) { 15 $(this).toggleClass('wishlist-list-active-button'); 16 } 17 18 //СкÑÑваем каÑÑоÑÐºÑ ÐµÑли пеÑедан ÑооÑвеÑвÑÑÑий Ñигнал и еÑли ÑеÑдеÑко ÑнÑÑо 19 if (hide){ 20 if (hasClass && !data.products.includes(productId)){ 21 $(this).parents('li[itemtype="http://schema.org/Product"]').hide(); 22 } 23 if (!hasClass && data.products.includes(productId)){ 24 location.reload(); 25 return; 26 } 27 } 28 } 29 ); 30 } 31 32 33 function periodicUpdateController(data) { 34 if (window.location.pathname == '/my/wishlist/') { 35 //location.reload(); 36 bypassingHearts(data, true) 37 return; 38 } 39 //ÐзмениÑÑ ÑеÑдеÑко коÑÐ·Ð¸Ð½Ñ Ð² веÑÑ Ð½ÐµÐ¹ ÑаÑÑи 40 changeTotal(data); 41 //ÐеÑÐµÐ¾Ð±Ñ Ð¾Ð´ ÑеÑдеÑек на ÑÑÑаниÑе 42 bypassingHearts(data); 43 } 44 45 46//ЦиклиÑеÑÐºÐ°Ñ Ð¿ÑовеÑка 47 var N = 5000; // 5 ÑекÑнд 48 setInterval(function () { 49 //ÐÑли полÑзоваÑÐµÐ»Ñ Ð½Ðµ авÑоÑизован пÑовеÑка не ÑÑебÑеÑÑÑ 50 if ($("#config").attr('userid') == 0) { 51 return; 52 } 53 let curentCount = $('span.wishlistcount').text(); 54 let curentDate = $('span.wishlistcount').attr('lastdate'); 55 $.ajax({
56 url: '/addinterfavorites/', 57 method: 'post', 58 dataType: 'json', 59 data: {mode: 'check'}, 60 success: function (data) { 61 if (data.data == 'ok') { 62 if (curentCount == 0 && data.count == 0) { 63 return; 64 } 65 if (curentDate != data.date || data.count != curentCount) { 66 //ÐаÑÑ Ð½Ðµ ÑовпадаÑÑ. ТÑебÑеÑÑÑ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ðµ. 67 periodicUpdateController(data); 68 return; 69 } 70 } 71 } 72 }); 73 //$('#targetBlock').toggleClass('className'); 74 }, N); 75 76 77 function changeTotal(data) { 78 $('span.wishlistcount').html(data.count); 79 $('span.wishlistcount').attr('lastdate', data.date); 80 } 81 82 83//ÐеÑÐµÑ Ð²Ð°Ñ Ð½Ð°Ð¶Ð°ÑÐ¸Ñ Ð½Ð° веÑÑ Ð½ÐµÐµ ÑеÑдеÑко ÐÐ 84 $(".pull-left.topFav").on("click", function () { 85 if ($("#config").attr('userid') == 0) { 86 $.fancybox.open($('#datafancybox').html()); 87 return false; 88 } 89 }); 90 91//ÐеÑÐµÑ Ð²Ð°Ñ Ð½Ð°Ð¶Ð°ÑÐ¸Ñ Ð½Ð° веÑÑ Ð½ÐµÐµ ÑеÑдеÑко ÐÐÐ 92 $("div#favBlock").on("click", function () { 93 if ($("#config").attr('userid') == 0) { 94 $.fancybox.open($('#datafancybox').html()); 95 return false; 96 } 97 }); 98 99 100 $(".wishlist-list-button").on("click", function () { 101 //ÐолÑзоваÑÐµÐ»Ñ Ð½Ðµ авÑоÑизован.. 102 if ($("#config").attr('userid') == 0) { 103 $.fancybox.open($('#datafancybox').html()); 104 return; 105 } 106 let productid = $(this).attr('data-product-id'); 107 let mode = ''; 108 if ($(this).hasClass('wishlist-list-active-button')) { 109 mode = 'dell'; 110 } else { 111 mode = 'add'; 112 } 113 let $this = $(this); 114 $.ajax({
115 url: '/addinterfavorites/', 116 method: 'post', 117 dataType: 'json', 118 data: {productid: productid, mode: mode}, 119 success: function (data) { 120 if (data.data == 'ok') { 121 $this.toggleClass('wishlist-list-active-button'); 122 changeTotal(data); 123 124 125 126 //еÑли дейÑÑвие из избÑанного Ñо пеÑезагÑÑжаем 127 if (window.location.pathname == '/my/wishlist/') { 128 //location.reload(); 129 $this.parents('li[itemtype="http://schema.org/Product"]').hide(); 130 } 131 132 } 133 } 134 }); 135 //ÐапиÑÑ Ð²ÑбÑанного знаÑÐµÐ½Ð¸Ñ 136 //let userid = $("#config").attr('userid'); 137 }); 138}) 139; 140
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.