1(window.evenrowheight = function() { 2 console.log ('start'); 3 $(".content__container--menu").each(function(i, e) { 4 $container = $(this); 5 $items = $("[data-type='preview']", $container); 6 console.log ('container', $container); 7 main_column_width = $(".main__column").width(); 8 item_width = $("div.item--preview:eq(0)", $container).width(); 9 width_koef = Math.floor(main_column_width/item_width); 10 total_item_count = $("[data-type='preview']", $container).length; 11 rowCount = Math.ceil (total_item_count / width_koef); 12 for (i=0; i<total_item_count; i+=width_koef) { 13 $items_in_row = $items.slice(i, i+width_koef); 14 maxHeight = Math.max.apply(null, $items_in_row.map(function () { return $(this).height(); }).get()); 15 console.log ('iir', $items_in_row, 'mx', maxHeight); 16 17 $items_in_row.height(maxHeight); 18 $(".item__price", $items_in_row).fadeIn(0); 19 } 20 }); 21}); 22 23function timeOut(e){ 24 setTimeout(function(){e.remove();}, 3000); 25 return false; 26} 27 28function scrollInto(elem) { 29 console.log('sI', elem, new Date()); 30 if (elem.height() < $(window).height()) { 31 c = elem.offset().top + (elem.height() / 2) - $(window).height()/2; 32// console.log ('c', c, elem.offset(),top, elem.height(), $(window).height 33 $.scrollTo(c, 0); 34 } else { 35 $.scrollTo(elem.offset().top - ($(window).height() - elem.height()), 0); 36 } 37} 38 39 40$(function() { 41 42 $(document).on("click", "[data-type='direct_link']", function(e) { 43 document.location.href = $(this).data('href'); 44 }); 45 46 47 $(document).on("click", "[data-type='preview']", function(e) { 48 elem = $(this); 49 target = $(e.target); 50 $container = elem.parents(".catalog-section"); 51 console.log('elem', elem, 'parent container', $container); 52 var n = 500; 53 console.log('clicl0 target=', target); 54 55 56 if (target.parents("[name='control_element']").length){ 57 console.log('control widget'); 58 return true; 59 } 60 61 if (!target.hasClass('btn--order')) { 62 console.log('btn0'); 63 pid = $(this).data('pid'); 64 console.log('pid=', pid); 65 if (window.matchMedia("(max-width: 1024px)")['matches'] && elem.data('href')) { 66 document.location.href = elem.data('href'); 67 } 68 else { 69// console.log('aa'); 70 if (!$("[data-type='full'][data-pid=" + pid + "]:visible", $container).length) { 71// console.log("OK1"); 72 main_column_width = $("div.listing").width(); 73 item_width = $("div.item--preview:visible", $container).width(); 74 width_koef = Math.floor(main_column_width/item_width); 75 total_item_count = $("[data-type='preview']:visible", $container).length; 76 itemIndex = $("[data-type='preview']:visible", $container).index(elem); 77 itemPositionInRow = (itemIndex % width_koef) + 1; 78 itemRow = Math.floor(itemIndex / width_koef) + 1; 79 rowCount = Math.ceil (total_item_count / width_koef); 80 81 console.log('total_item_count', total_item_count, 'mcw', main_column_width, 'width_koef', width_koef, 'itemRow', itemRow, item_width, $container); 82 83 if (itemRow == rowCount) { // last row 84 lastItemInRow = $("[data-type='preview']:visible", $container).length - 1; 85 console.log('method 1'); 86 } else { 87 lastItemInRow = (width_koef*itemRow)-1; 88 console.log('method 2'); 89 } 90 91 $("[data-type='preview']").removeClass('item--active'); 92 elem.addClass('item--active'); 93 94 console.log('lastiteminrow', lastItemInRow); 95 96 $("[data-type='full']:not('.item--page')").hide(); 97 $("[data-type='full'][data-pid=" + pid + "]:not('.item--page')").insertAfter($("[data-type='preview']:visible", $container).eq(lastItemInRow)).addClass('item--opened').fadeIn(300); 98 99 100 fullDiv = $("[data-type='full']:visible"); 101 if (fullDiv.length) { 102 //console.log ('elem', elem, 'fullDiv', fullDiv, 'etop full', fullDiv.offset().top, 'elem.height', elem.height(), 'window.height', $(window).height()) 103 if (fullDiv.find('.slick-slider').length) console.log('slick found'); 104 else { 105 console.log('slick not found, initializing');
106 if (fullDiv.find(".item__full-slider").length) fullDiv.find(".item__full-slider").slick({ 107 slidesToShow: 1, 108 slidesToScroll: 1, 109 arrows: true, 110 fade: false, 111 appendArrows: jQuery('.restaraunt-modal__controls', fullDiv), 112 prevArrow: '<div class="restaraunt-modal__control restaraunt-modal__control--prev"></div>', 113 nextArrow: '<div class="restaraunt-modal__control restaraunt-modal__control--next"></div>' 114 }); 115 } 116 117 118 scrollInto(fullDiv); 119 } 120 121 } else { 122 $("[data-type='full'][data-pid=" + pid + "]:not('.item--page')").fadeOut(0); 123 $("[data-type='preview']").removeClass('item--active'); 124 $("[data-type='full']:not('.item--page')").removeClass('item--opened'); 125 } 126 } 127 } 128 129 130 }); 131 132 $("[data-name='item_increment']:not('.toppings__more, .toppings__less')").click(function() { 133 134 console.log('increment'); 135 136 $p = $(this).parents("[data-type='full'], [data-type='preview']"); 137 138 139 pid = $(this).data('pid'); 140 unit = $(this).data('unit'); 141 ca = parseFloat($(this).data('change-amount')) || 1; 142 143 qtyElem = $("[data-name='item_quantity'][data-pid='" + pid + "']"); 144 145 unitElem = $("[data-name='item_quantity'][data-pid='" + pid + "']"); 146 147 qty = parseFloat(qtyElem.data('qty') || qtyElem.data('initialvalue')); 148 console.log('parent', $p, 'pid', pid, 'qtyELem', qtyElem, 'qty', qty, 'ca', ca); 149 150 qty += ca; 151 qty = qty.toFixed(0); 152 qtyElem.data('qty', qty).text(qty).val(qty); 153 154 155 156 }); 157 158 159 $("[data-name='item_decrement']:not('.toppings__more, .toppings__less')").click(function() { 160 161 console.log('increment'); 162 163 pid = $(this).data('pid'); 164 unit = $(this).data('unit'); 165 ca = parseFloat($(this).data('change-amount')) || 1; 166 167 qtyElem = $("[data-name='item_quantity'][data-pid='" + pid + "']"); 168 unitElem = $("[data-name='item_quantity'][data-pid='" + pid + "']"); 169 170 qty = parseFloat(qtyElem.data('qty') || qtyElem.data('initialvalue')); 171 console.log('qty', qty); 172 173 qty = qty - ca || qty; 174 qty = qty.toFixed(0); 175 qtyElem.data('qty', qty).text(qty).val(qty); 176 177 178 179 }); 180 181 $(document).on("click", "[data-type='full'] a[name='close_full_cross']", function(e) { 182 console.log('CLOSE'); 183 e.preventDefault(); 184 $("[data-type='full']:not('.item--page')").fadeOut(150); 185 pd = $("[data-type='preview'].item--active"); 186 //console.log('pd', pd); 187 if (pd.length) scrollInto(pd); 188 $("[data-type='preview']").removeClass('item--active'); 189 190 }); 191 192 $(document).on("click", ".toppings__clear", function(e) { 193 e.preventDefault(); 194 var t = $(this).parents('div[data-type="preview"], div[data-type="full"]'); 195 t.find("input[name='toppings__value']").val(0).removeClass('toppings__value--selected'); 196 t.find("span.item__price-value").text(t.find("span.item__price-value").data('baseprice')); 197 $(".toppings__more, .toppings__less").removeClass('disabled'); 198 }); 199 200 $(document).on("click", "[data-type='full'] div.item__kcal", function(event) { 201 console.log ('t', $(event.target), 'p', $(event.target).parents("[data-type='full']")); 202 $("div.nutr-value", $(event.target).parents("[data-type='full']")).toggleClass('nutr-value--vis'); 203 }); 204 205 206 $(document).on("click", "[data-type='full'] div.nutr-value", function(event) { 207 console.log ('t', $(this)); 208 $(this).toggleClass('nutr-value--vis'); 209 }); 210 211 $(document).on("click", ".filter__item", function(e) { 212 $(".filter__item").removeClass("filter__item--active"); 213 214 $sorting_item = $(this); 215 //console.log ('si2', $(e.target)); 216 $sorting_item.addClass('filter__item--active'); 217 flagid = parseInt($(this).data('id')); 218 if (flagid == 0) { 219 $('.content__title').show(); 220 $("[data-type='preview']").show(); 221 $("div.offer").show(); 222 223 } else { 224 $("div.offer").hide(); 225 $("[data-type='full']").hide(); 226 $("[data-type='preview']").removeClass('item--active'); 227 $("[data-type='preview']").each(function(i, elem) { 228 //console.log ('elem', $(elem), 'data', $(elem).data('flags')); 229 flags = $(elem).data('flags') ? $(elem).data('flags').toString() : ''; 230 if (flags) { 231 flagsArr = flags.split(",").map(function(x) { return parseInt(x) }); 232 $(elem).toggle($.inArray(flagid, flagsArr) != -1); 233// console.log (flagsArr, flagid, $.inArray(flagid, flagsArr) != -1); 234 } else { 235 $(elem).hide(); 236 } 237 }); 238 } 239 240 241 if ($sorting_item.parents(".restaraunts-map").length) { 242 places2 = []; 243 removePlacemarks(window.map); 244 currentFilteredPlaces = $("div.listing div[data-type='preview']:visible").map(function() { return $(this).data('pid'); }); 245 //console.log('currentFP', currentFilteredPlaces); 246 $.each(places, function(i, place) { 247 placePid = place[2]; 248 if ($.inArray(placePid, currentFilteredPlaces) != -1) places2.push(place); 249 //console.log('place1', place, 'placePid', placePid); 250 }); 251 //console.log('places2', places2); 252 addPlacemarks(window.map, places2); 253 } 254 255 256 $('.content__title').show(); 257 $(".content__container--menu").not(':has(div.item:visible)').prev('.content__title').hide() 258 e.preventDefault(); 259 }); 260 261 $(document).on("click", "a.btn--order", function(e) { 262 e.preventDefault(); 263 var t = $(this).parents('div[data-type="preview"], div[data-type="full"], [data-type="full_static"]'); 264 //var tAll = $(this).parents('div[data-type="preview"], div[data-type="full"]').eq(0); 265 266 itemUID = pid = t.data('pid'); 267// console.log (itemUID); 268// console.log ('pid', pid); 269 270 var tAll = $("div[data-type='preview'][data-pid='" + pid + "'], div[data-type='full'][data-pid='" + pid + "']"); 271 var addSuccess = 1; 272 273 274 var toppings = []; 275 t.find("input[name='toppings__value']").each(function(i, e) { 276 $elem = $(e); 277 name = $elem.data('pname'); 278 tPid = $elem.data('pid'); 279 console.log('tPid', tPid); 280 price = g[tPid][0]; 281 282 if (parseInt($elem.val())) { 283 toppings.push({pid: $elem.data('pid'), price: parseFloat(price), quantity: parseInt($elem.val()), name: name }); 284 } 285 }); 286 287 t.find("input[name='toppings__value']").val(0).removeClass('toppings__value--selected'); 288// t.find(".toppings__trigger").click(); 289 t.find("span.item__price-value").text(t.find("span.item__price-value").data('baseprice')); 290 291 $.getJSON('/alltovar-tech2.php?version=33&p_f_2_temp_id=20&p_f_2_id=' + pid, function (data) { 292 var items = [];7 293 $.each(data, function(k, item) { 294// console.log (item); 295 296 itemBaseCategory = item['basecategory']; 297 itemCategory = item['category'];
298 itemName = item['name']; 299 delivery_types = item['delivery_types']; 300 console.log("DT", delivery_types); 301 302 console.log('ibc', itemBaseCategory); 303 304 var n7 = $.grep(simpleCart.items(), function(elem, i) { return $.inArray(elem.get('category'), [2920,2849,2880,2881,2882,2883,2884,2885,2886])!=-1 || elem.get('uid2') == '9065' || elem.get('uid2') == '9148'; }); 305 var alcoItems = $.grep(simpleCart.items(), function(elem, i) { return $.inArray(elem.get('category'), [2764])!=-1 }); 306 var pickupItems = $.grep(simpleCart.items(), function(elem, i) { return elem.get('delivery_types') && elem.get('delivery_types').includes('pickup') && elem.get('delivery_types').length == 1 }); 307 console.log("PICKUP_ITEMS", pickupItems); 308 309 console.log ("n7pickup check", n7.length, delivery_types.includes('pickup'), delivery_types.length); 310 311 if (n7.length && itemCategory == 2764) { 312 emptyBasket = confirm ("РваÑей коÑзине еÑÑÑ ÑÐ¾Ð²Ð°Ñ ÐºÐ°ÑегоÑии «ÐомаÑнÑÑ ÐºÑлинаÑиÑ». Ð ÑÑом ÑлÑÑае добавление ÑоваÑа каÑегоÑии «ÐлкоголÑ» Ð½ÐµÐ²Ð¾Ñ Ð¼Ð¾Ð¶Ð½Ð¾. \n\n ÐелаеÑе оÑиÑÑиÑÑ ÐºÐ¾ÑÐ·Ð¸Ð½Ñ Ð¸ добавиÑÑ Â«" + itemName + "»?"); 313 if (emptyBasket) simpleCart.empty(); 314 else { console.log("no agreement"); addSuccess = 0; return; }; 315 } 316 317 if (n7.length && delivery_types.includes('pickup') && delivery_types.length == 1) { 318 emptyBasket = confirm ("РваÑей коÑзине еÑÑÑ ÑÐ¾Ð²Ð°Ñ ÐºÐ°ÑегоÑии «ÐомаÑнÑÑ ÐºÑлинаÑиÑ». Ð ÑÑом ÑлÑÑае добавление ÑоваÑов ÑолÑко на ÑамовÑвоз невозможно. \n\n ÐелаеÑе оÑиÑÑиÑÑ ÐºÐ¾ÑÐ·Ð¸Ð½Ñ Ð¸ добавиÑÑ Â«" + itemName + "»?"); 319 if (emptyBasket) simpleCart.empty(); 320 else { console.log("no agreement"); addSuccess = 0; return; }; 321 } 322 323 if (pickupItems.length && $.inArray(itemCategory, [2920,2849,2880,2881,2882,2883,2884,2885,2886])!=-1) { 324 emptyBasket = confirm ("РваÑей коÑзине еÑÑÑ ÑÐ¾Ð²Ð°Ñ ÑолÑко на ÑамовÑвоз. Ð ÑÑом ÑлÑÑае добавление ÑоваÑа каÑегоÑии «ÐомаÑнÑÑ ÐºÑлинаÑиÑ» невозможно. \n\n ÐелаеÑе оÑиÑÑиÑÑ ÐºÐ¾ÑÐ·Ð¸Ð½Ñ Ð¸ добавиÑÑ Â«" + itemName + "»?"); 325 if (emptyBasket) simpleCart.empty(); 326 else { addSuccess = 0; return }; 327 } 328 329 330 if (alcoItems.length && $.inArray(itemCategory, [2920,2849,2880,2881,2882,2883,2884,2885,2886])!=-1) { 331 emptyBasket = confirm ("РваÑей коÑзине еÑÑÑ ÑÐ¾Ð²Ð°Ñ ÐºÐ°ÑегоÑии «ÐлкоголÑ». Ð ÑÑом ÑлÑÑае добавление ÑоваÑа каÑегоÑии «ÐомаÑнÑÑ ÐºÑлинаÑиÑ» невозможно. \n\n ÐелаеÑе оÑиÑÑиÑÑ ÐºÐ¾ÑÐ·Ð¸Ð½Ñ Ð¸ добавиÑÑ Â«" + itemName + "»?"); 332 if (emptyBasket) simpleCart.empty(); 333 else { addSuccess = 0; return }; 334 } 335 336 337 if (typeof(localStorage) != 'undefined') { 338// console.log('ibc', itemBaseCategory, 'tort?', itemBaseCategory == 'ТоÑÑÑ'); 339 if (itemBaseCategory == 'ÐаÑаваи') { 340 //alert ('Ðаказ каÑаваев оÑÑÑеÑÑвлÑеÑÑÑ Ð·Ð° 4 Ð´Ð½Ñ Ð´Ð¾ даÑÑ Ð´Ð¾ÑÑавки'); localStorage.setItem('karavaialert', 1); 341 $("#alert_loaf").addClass('popup--opened'); 342 $(".wrapper__col--right").addClass('wrapper__col--blured'); 343 $(".overlay").addClass('overlay--active'); 344 } 345 if (itemBaseCategory == 'ТоÑÑÑ') { 346 console.log('TORT'); 347 //alert ('Ðаказ ÑоÑÑов оÑÑÑеÑÑвлÑеÑÑÑ Ð·Ð° 1 Ð´ÐµÐ½Ñ Ð´Ð¾ даÑÑ Ð´Ð¾ÑÑавки'); localStorage.setItem('tortialert', 1); 348 $("#alert_cake").addClass('popup--opened'); 349 $(".wrapper__col--right").addClass('wrapper__col--blured'); 350 $(".overlay").addClass('overlay--active'); 351 } 352 if (itemBaseCategory == 'Ðовогодние бокÑÑ') { 353 //alert ('Ðаказ пиÑогов оÑÑÑеÑÑвлÑеÑÑÑ Ð·Ð° 1 Ð´ÐµÐ½Ñ Ð´Ð¾ даÑÑ Ð´Ð¾ÑÑавки'); localStorage.setItem('pirogialert', 1); 354 console.log('box order'); 355 $("#boxes_wow").addClass('popup--opened'); 356 $(".wrapper__col--right").addClass('wrapper__col--blured'); 357 $("#boxes_wow").addClass('overlay--active'); 358 } 359 360 if (itemBaseCategory == 'ÐиÑоги') { 361 //alert ('Ðаказ пиÑогов оÑÑÑеÑÑвлÑеÑÑÑ Ð·Ð° 1 Ð´ÐµÐ½Ñ Ð´Ð¾ даÑÑ Ð´Ð¾ÑÑавки'); localStorage.setItem('pirogialert', 1); 362 $("#alert_pie").addClass('popup--opened'); 363 $(".wrapper__col--right").addClass('wrapper__col--blured'); 364 $(".overlay").addClass('overlay--active'); 365 } 366 367 if (itemBaseCategory == 'ÐеÑегиÑе ÑебÑ') { 368 $("#alert_behealthy").addClass('overlay--active'); 369 } 370 371 372 } 373 374 375 item['quantity']= $("[data-name='item_quantity'][data-pid='" + item['uid'] + "']").val(); 376 console.log('quantity add', item['quantity']); 377 item['toppings']= toppings.length ? toppings : false;
378 379 if (toppings.length) { 380 item['uid2'] = item['uid']; 381 item['uid'] = parseInt(100000000 * Math.random()); 382 var ts = 0; 383 $.each(item['toppings'], function(i, e) { 384 ts += e['price'] * e['quantity']; 385 console.log ('e', e); 386 }); 387 console.log ('ts', ts); 388 finalPrice = item['price'] + ts; 389 item['price1'] = item['price'] = parseFloat(finalPrice).toFixed(2); 390 item['constructed']=1; 391// item['price1'] = item['price'] + ts; 392 console.log('item price1=', item['price1']); 393 console.log ("toppings exists", toppings); 394 simpleCart.add(item); 395 simpleCart.update(); 396 statSend(item, 'add'); 397 398 399 } 400 else { 401 if (!simpleCart.find({uid:item['uid'], toppings:false}).length) { 402 simpleCart.add(item); 403 simpleCart.update(); 404 statSend(item, 'add'); 405 console.log('add new itemdone'); 406 407 } 408 else { 409 itemUID = item['uid']; 410 existingItems = simpleCart.find({uid:itemUID, toppings: false}); 411 if (item['uid'] && existingItems) { 412 quantity = existingItems[0].quantity(); 413 existingItems[0].quantity(quantity+1); 414 } 415 simpleCart.update(); 416 console.log('modify quantity done'); 417 } 418 419 } 420 }); 421 422 423 pidS = pid.toString(); 424 if (simpleCart.find({'uid': pidS}).length) { 425 q1 = simpleCart.find({'uid': pidS})[0].quantity(); 426 console.log('q1 found', q1); 427 } 428 else { 429 q1 = 1; 430 console.log('q1 NOT FOUND', q1); 431 } 432 433 console.log('tAll', tAll, 'Q1', q1, 'pid', pid); 434 435 if (addSuccess) { 436 tAll.addClass('added');
437 tAll.find(".item__add-text").text("Ðобавлено " + q1 + " в коÑзинÑ"); 438 } 439 440 441 }); 442 443 444 //t.find(".item__add").addClass('item__add--vis'); 445 t.parents(".news__item").find('.news__add').addClass('news__add--vis'); 446 //setTimeout(function() { t.find(".item__add").removeClass('item__add--vis'); }, 700); 447 //setTimeout(function() { t.parents(".news__item").find('.news__add').removeClass('news__add--vis'); }, 700); 448 449 $iv = $("div[name='item__price-value']"); 450 $iv.text($iv.data('baseprice')); 451 $(".cart2").addClass('cart--shake'); 452 setTimeout(function() { $(".cart2").removeClass('cart--shake'); }, 1000); 453 enableToppings(t); 454 455 456 }); 457 458 459 function disableToppings(item) { 460 console.log ('disableToppings t=', item); 461 item.find("input[name='toppings__value']").each(function(i, e) { 462 if (!parseInt($(e).val())) { 463 console.log ('elem for disabling', $(e), 'val', $(e).val()); 464 $(e).siblings(".toppings__more, .toppings__less").addClass('disabled'); 465 $(e).addClass('disabled'); 466 } 467 }); 468 } 469 470 function enableToppings(item) { 471// console.log ('enableToppings'); 472 item.find("input[name='toppings__value']").each(function(i, e) { 473 $(e).siblings(".toppings__more, .toppings__less").removeClass('disabled'); 474 $(e).removeClass('disabled'); 475 }); 476 } 477 478 function statSend(item, action) { 479// console.log('ss add', item, action); 480 if (typeof(ga) != 'undefined') { 481 ga('ec:addProduct', { 482 'id': item['uid'], 483 'name': item['name'], 484 'category': item['basecategory'], 485 'price': item['price'], 486 'brand': '', 487 'variant': '', 488 'quantity': 1 489 }); 490 ga('ec:setAction', action); 491 ga('send', 'event', 'UX', 'click', 'add to cart'); 492 if (action == 'add') ga('send', 'event', 'order', 'addtocart'); 493 } 494 495 window.dataLayer = window.dataLayer || []; 496 var wdl = {}; 497 p = {'id': item['uid'], 'name': item['name'], 'category': item['basecategory'], 'price': item['price'], 'brand': '','variant': '','quantity': 1}; 498 var tmp = {}, p0 = {}, p1 = {}; 499 tmp[action] = {"actionField": { "id" : Math.floor(99999999999*Math.random()) }, "products": [p] }; 500 p0 = $.extend(wdl, tmp); 501 p1['ecommerce'] = p0; 502 //if (action) window.dataLayer.push(p1); 503 504 505 } 506 507 508 $(document).on("click", ".toppings__more, .toppings__less", function(e) { 509 510 function itemToppingsTotal(item) { 511 var total = 0; 512 item.find("input[name='toppings__value']").each(function(i, e) { 513 total += parseInt($(e).val()); 514 }); 515// console.log ('total', total); 516 return total; 517 } 518 519 520 var t = $(this).parents('div[data-type="preview"], div[data-type="full"]'); 521 var itemMaxToppings = $(this).parents("div[data-type='full']").data("max-toppings") || 3; 522 console.log ('imt', itemMaxToppings); 523 524 525 $elem = $(e.target); 526// console.log ('hc', $elem.hasClass('toppings__more'), $elem); 527 if ($(this).hasClass('toppings__more')) { 528 q = parseInt($(this).siblings("[name='toppings__value']").val()); 529 console.log ('q0', q); 530 total = itemToppingsTotal(t); 531 if (total < itemMaxToppings) { 532 q < 9 ? q++ : q; 533 $(this).siblings("[name='toppings__value']").toggleClass('toppings__value--selected', !!q).val(q).val(q); 534 console.log ('qm=', q); 535 if (q < 9 && total == itemMaxToppings-1) disableToppings(t); 536 537 } 538 539 } else { 540 q = parseInt($(this).siblings("[name='toppings__value']").val()); 541 console.log ('ql', q); 542 q = q >= 2 ? (q - 1) : 0; 543 console.log ('decremented q=', q); 544 $(this).siblings("[name='toppings__value']").toggleClass('toppings__value--selected', !!q).val(q); 545 total = itemToppingsTotal(t); 546 if (total < itemMaxToppings) { 547 enableToppings(t); 548 } 549 550 } 551 552 553 ts = 0; 554 t.find("input[name='toppings__value']").each(function(i, e) { 555 $elem = $(e); 556 tPid = $(this).data('pid'); 557 console.log ('elem toping', $elem, 'tPid', tPid ); 558 name = $elem.parents(".toppings__item").find(".toppings__name").text(); 559 price = g[tPid][0]; 560 console.log ('elem topping price', price); 561 if (parseInt($elem.val())) { 562 ts += price * parseInt($elem.val()); 563 } 564 }); 565 566 ts = parseFloat(ts).toFixed(2); 567 568 baseprice = parseFloat(t.find("span.item__price-value").data('baseprice') || $("div[name='item__price-value']").data('baseprice')).toFixed(1); 569 console.log ('tsbp', baseprice, ts); 570 571 var finalPrice = parseFloat(baseprice) + parseFloat(ts); 572 573 t.find("span.item__price-value").text(finalPrice); 574 $("div[name='item__price-value']").text(finalPrice); 575 //t.find("span.toppings__total").text(baseprice + ts); 576 577 578 }); 579 580 $("[id='sidebar_menu_link']").click(function(e) { 581 e.preventDefault(); 582 $("[id='sidebar_menu_container']").slideDown(300); 583 }); 584 585 /* 586 var itemUID = t.find("input[name='itemUID']").val(), 587 itemQuantity = 1, 588 itemCategory = t.find("input[name='itemCategory']").val(), 589 itemBaseCategory = t.find("input[name='itemBaseCategory']").val(), 590 itemName = $("span.item_name", t).text(), 591 itemPrice = $("span.item_price3", t).text() || $("span.item_price", t).text(), 592 // itemPrice2 = $("span.item_price2", t).text(), 593 itemPrice2 = 0, 594 itemAnons = $("span.item_anons", t).text(), 595 itemCalories = $("span.item_calories", t).text(), 596 itemImage = $("span.item_image img", t).attr('src'), 597 itemHref = $("a", t).attr('href'), 598 itemData = {}; 599 600 $.ajax({url: itemHref.replace(/product|popup/, "product-data").replace(/.html/, "") + "?" + Math.random(500), 601 type: "GET", 602 dataType: "json", 603 async: false, 604 success: function(data) { 605 itemData = data; 606 } 607 }); 608 609 610 var $cart = $('.cart2'); 611 if ($cart.length) { 612 $window = $(window); 613 offset = $cart.offset(); 614 topPadding = 0; 615 616 if ($window.scrollTop() > offset.top && !simpleCart.items().length) { 617 $(".cart2").css({ 618 'top': '0', 619 'position': 'fixed' 620 }).removeClass('cartNoPosition').addClass('cartFixedPosition'); 621 } 622 } 623 624 //console.log ('flags', itemData['flags']); 625 626 if (!simpleCart.find({uid:itemUID}).length) { 627 simpleCart.add({ 628 uid: itemUID, 629 name: itemName, 630 price: itemPrice, 631 price1: itemPrice, 632 // price2: itemPrice2 || 0, 633 price2: 0, 634 baseprice: itemPrice, 635 basecategory: itemBaseCategory,
636 category: itemCategory, 637 quantity: itemQuantity, 638 image: itemImage, 639 anons: itemAnons, 640 calories: itemCalories, 641 href: itemHref, 642 iiko_id: itemData['iiko_id'], 643 iiko_id2: itemData['iiko_id2'], 644 sort_order: 1, 645 flags: itemData['flags'] 646 }); 647 } 648 else { 649 simpleCart.find({uid:itemUID})[0].quantity(itemQuantity); 650 } 651 652 simpleCart.update(); 653 // simpleCart.checkFIState(); 654 // simpleCart.checkFIState(); 655 656 var counter = 0; 657 /* 658 looper = setInterval(function () { 659 a = $("ul[id^='select-item']", t); 660 661 662 if (a.hasClass('select-num2')) 663 a.removeClass('select-num2'); 664 else 665 a.addClass('select-num2'); 666 667 console.log (a); 668 669 670 if (counter++ > 7) { 671 clearInterval(looper); 672 a.removeClass('select-num2'); 673 $("span[id*='SelectBoxItText']", t).text(0).attr('data-val', 0); 674 } 675 }, 1000); 676 */ 677 678 /* 679 window.isOverP = 0; 680 $("li.li0", $(this).parent("ul")).text(itemQuantity); 681 682 $("#cartPopover").slideDown(500); 683 $(".cartInfo").addClass('open'); 684 685 setTimeout(function () { 686 if (!window.isOverP) { 687 $("#cartPopover").slideUp(500); 688 $(".cartInfo").removeClass('open'); 689 } 690 }, 2500); 691 692 */ 693 694 695});
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.