1BasketPoolQuantity = function() { 2 this.processing = false; 3 this.poolQuantity = {}; 4 this.updateTimer = null; 5 this.currentQuantity = {}; 6 this.lastStableQuantities = {}; 7 8 this.updateQuantity(); 9}; 10 11BasketPoolQuantity.prototype.updateQuantity = function() { 12 var items = BX.findChildren(BX('cart_equipment'), {className: 'tr'}, true); 13 if(!!items && items.length > 0) { 14 for(var i = 0; items.length > i; i++) { 15 var itemId = items[i].id; 16 this.currentQuantity[itemId] = BX('QUANTITY_' + itemId).value; 17 } 18 } 19 20 if(parseInt(BX("min_price_vlue").value)> parseInt(BX("total_price_basket").value)){ 21 BX.removeClass(BX("min_price_message"), 'disN'); 22 BX.addClass(BX("min_price_message"), 'disB'); 23 BX("boc_anch_cart").disabled = true; 24 BX("btn_basket_order").disabled = true; 25 26 }else{ 27 BX("boc_anch_cart").disabled = false; 28 BX("btn_basket_order").disabled = false; 29 BX.removeClass(BX("min_price_message"), 'disB'); 30 BX.addClass(BX("min_price_message"), 'disN'); 31 } 32 33 this.lastStableQuantities = BX.clone(this.currentQuantity, true); 34}; 35 36BasketPoolQuantity.prototype.changeQuantity = function(itemId) { 37 var quantity = BX('QUANTITY_' + itemId).value; 38 var isPoolEmpty = this.isPoolEmpty(); 39 40 if(this.currentQuantity[itemId] && this.currentQuantity[itemId] != quantity) { 41 this.poolQuantity[itemId] = this.currentQuantity[itemId] = quantity; 42 } 43 44 if(!isPoolEmpty) { 45 this.enableTimer(true); 46 } else { 47 this.trySendPool(); 48 } 49}; 50 51BasketPoolQuantity.prototype.trySendPool = function() { 52 if(!this.isPoolEmpty() && !this.isProcessing()) { 53 this.enableTimer(false); 54 recalcBasketAjax({}); 55 } 56}; 57 58BasketPoolQuantity.prototype.isPoolEmpty = function() { 59 return(Object.keys(this.poolQuantity).length == 0); 60}; 61 62BasketPoolQuantity.prototype.clearPool = function() { 63 this.poolQuantity = {}; 64}; 65 66BasketPoolQuantity.prototype.isProcessing = function() { 67 return(this.processing === true); 68}; 69 70BasketPoolQuantity.prototype.setProcessing = function(value) { 71 this.processing = (value === true); 72}; 73 74BasketPoolQuantity.prototype.enableTimer = function(value) { 75 clearTimeout(this.updateTimer); 76 if(value === false) 77 return; 78 this.updateTimer = setTimeout(function(){ basketPoolQuantity.trySendPool(); }, 1500); 79}; 80 81function updateBasketTable(basketItemId, res) { 82 //update product params after recalculation 83 if(!!res.BASKET_DATA) { 84 for(id in res.BASKET_DATA.GRID.ROWS) { 85 if(res.BASKET_DATA.GRID.ROWS.hasOwnProperty(id)) { 86 var item = res.BASKET_DATA.GRID.ROWS[id]; 87 88 //ITEM_PRICE// 89 if(BX("price_" + id)) 90 BX("price_" + id).innerHTML = item.PRICE_FORMATED; 91 92 //ITEM_REFERENCE_PRICE// 93 if(BX("reference-price_" + id)) { 94 var itemReferenceCont = $(BX("reference-price_" + id)), 95 itemReferenceCoef = itemReferenceCont.data("reference-coef"), 96 dec_point = itemReferenceCont.data("dec-point"), 97 thousands_sep = itemReferenceCont.data("separator"), 98 decimals = itemReferenceCont.data("reference-decimal"); 99 if(itemReferenceCont.data("hide-zero") == "Y") { 100 if(Math.abs(parseFloat(item.PRICE * itemReferenceCoef).toFixed(decimals)) == Math.abs(parseFloat(item.PRICE * itemReferenceCoef).toFixed(0))) { 101 decimals = 0; 102 } 103 } 104 BX("itemReferenceVal_" + id).innerHTML = number_format(item.PRICE * itemReferenceCoef, decimals, dec_point, thousands_sep); 105 } 106 107 //ITEM_OLD_PRICE// 108 if(BX("old-price_" + id)) 109 BX("old-price_" + id).innerHTML = (item.FULL_PRICE_FORMATED != item.PRICE_FORMATED) ? item.FULL_PRICE_FORMATED : ''; 110 111 //ITEM_UNIT// 112 if(BX("unit_" + id)) 113 BX("unit_" + id).innerHTML = item.MEASURE_TEXT; 114 115 //ITEM_SUM// 116 if(BX("cart-item-summa_" + id)) { 117 var itemSumCont, 118 itemSumOld, 119 itemSumCurr, 120 decimals; 121 122 itemSumCont = $(BX("cart-item-summa_" + id)); 123 124 itemSumOld = itemSumCont.data("itemsum"); 125 itemSumCont.data("itemsum", (item.PRICE * item.QUANTITY)); 126 itemSumCurr = itemSumCont.data("itemsum"); 127 128 if(itemSumCurr != itemSumOld) { 129 decimals = itemSumCont.data("decimal"); 130 if(itemSumCont.data("hide-zero") == "Y") { 131 if(Math.abs(parseFloat(itemSumCurr).toFixed(decimals)) == Math.abs(parseFloat(itemSumCurr).toFixed(0))) { 132 decimals = 0; 133 } 134 } 135 var options = {
136 useEasing: false, 137 useGrouping: true, 138 separator: itemSumCont.data("separator"), 139 decimal: itemSumCont.data("dec-point") 140 } 141 var counter = new countUp("itemSumVal_" + id, itemSumOld, itemSumCurr, decimals, 0.5, options); 142 counter.start(); 143 } 144 145 //ITEM_REFERENCE_SUM// 146 if(BX("itemReferenceSumVal_" + id)) { 147 var itemReferenceSumCoef, 148 itemReferenceSumOld, 149 itemReferenceSumCurr; 150 151 itemReferenceSumCoef = itemSumCont.data("itemreferencesumcoef"); 152 itemReferenceSumOld = itemSumCont.data("itemreferencesum"); 153 itemSumCont.data("itemreferencesum", (item.PRICE * item.QUANTITY * itemReferenceSumCoef)); 154 itemReferenceSumCurr = itemSumCont.data("itemreferencesum"); 155 156 if(itemReferenceSumCurr != itemReferenceSumOld) { 157 decimals = itemSumCont.data("reference-decimal"); 158 if(itemSumCont.data("hide-zero") == "Y") { 159 if(Math.abs(parseFloat(itemReferenceSumCurr).toFixed(decimals)) == Math.abs(parseFloat(itemReferenceSumCurr).toFixed(0))) { 160 decimals = 0; 161 } 162 } 163 var options = { 164 useEasing: false, 165 useGrouping: true, 166 separator: itemSumCont.data("separator"), 167 decimal: itemSumCont.data("dec-point") 168 } 169 var counter = new countUp("itemReferenceSumVal_" + id, itemReferenceSumOld, itemReferenceSumCurr, decimals, 0.5, options); 170 counter.start(); 171 } 172 } 173 } 174 175 //if the quantity was set by user to 0 or was too much, we need to show corrected quantity value from ajax response 176 if(BX("QUANTITY_" + id)) { 177 BX('QUANTITY_INPUT_' + id).value = item.QUANTITY; 178 BX('QUANTITY_INPUT_' + id).defaultValue = item.QUANTITY; 179 180 BX('QUANTITY_' + id).value = item.QUANTITY; 181 } 182 } 183 } 184 } 185 186 //update coupon info 187 if(!!res.BASKET_DATA) 188 couponListUpdate(res.BASKET_DATA); 189 190 //update warnings if any 191 if(res.hasOwnProperty('WARNING_MESSAGE')) { 192 var warningText = ''; 193 for(i = res['WARNING_MESSAGE'].length - 1; i >= 0; i--) 194 warningText += res['WARNING_MESSAGE'][i] + '<br/>'; 195 BX('warning_message').innerHTML = warningText; 196 } 197 198 //update total basket values 199 if(!!res.BASKET_DATA) { 200 //ALL_SUM// 201 if(BX("cart-allsum")) { 202 var allSumCont, 203 allSumOld, 204 allSumCurr, 205 decimals; 206 207 allSumCont = $(BX("cart-allsum")); 208 209 allSumOld = allSumCont.data("allsum"); 210 allSumCont.data("allsum", res["BASKET_DATA"]["allSum"]); 211 allSumCurr = allSumCont.data("allsum"); 212 213 if(allSumCurr != allSumOld) { 214 decimals = allSumCont.data("decimal"); 215 if(allSumCont.data("hide-zero") == "Y") { 216 if(Math.abs(parseFloat(allSumCurr).toFixed(decimals)) == Math.abs(parseFloat(allSumCurr).toFixed(0))) { 217 decimals = 0; 218 } 219 } 220 var options = { 221 useEasing: false, 222 useGrouping: true, 223 separator: allSumCont.data("separator"), 224 decimal: allSumCont.data("dec-point") 225 } 226 var counter = new countUp("allSumVal", allSumOld, allSumCurr, decimals, 0.5, options); 227 counter.start(); 228 229 BX("total_price_basket").value=allSumCurr; 230 } 231 232 //ALL_REFERENCE_SUM// 233 if(BX("allReferenceSumVal")) { 234 var allReferenceSumCoef, 235 allReferenceSumOld, 236 allReferenceSumCurr; 237 238 allReferenceSumCoef = allSumCont.data("allreferencesumcoef"); 239 allReferenceSumOld = allSumCont.data("allreferencesum"); 240 allSumCont.data("allreferencesum", (res["BASKET_DATA"]["allSum"] * allReferenceSumCoef)); 241 allReferenceSumCurr = allSumCont.data("allreferencesum"); 242 243 if(allReferenceSumCurr != allReferenceSumOld) { 244 decimals = allSumCont.data("reference-decimal"); 245 if(allSumCont.data("hide-zero") == "Y") { 246 if(Math.abs(parseFloat(allReferenceSumCurr).toFixed(decimals)) == Math.abs(parseFloat(allReferenceSumCurr).toFixed(0))) { 247 decimals = 0; 248 } 249 } 250 var options = { 251 useEasing: false, 252 useGrouping: true, 253 separator: allSumCont.data("separator"),
254 decimal: allSumCont.data("dec-point") 255 } 256 var counter = new countUp("allReferenceSumVal", allReferenceSumOld, allReferenceSumCurr, decimals, 0.5, options); 257 counter.start(); 258 } 259 } 260 261 BX.onCustomEvent("OnBasketChange"); 262 } 263 } 264} 265 266function number_format(number, decimals, dec_point, thousands_sep) { 267 number = (number + "").replace(/[^0-9+\-Ee.]/g, ""); 268 var n = !isFinite(+number) ? 0 : +number, 269 prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), 270 sep = (typeof thousands_sep === "undefined") ? "," : thousands_sep, 271 dec = (typeof dec_point === "undefined") ? "." : dec_point, 272 s = "", 273 toFixedFix = function (n, prec) { 274 var k = Math.pow(10, prec); 275 return "" + Math.round(n * k) / k; 276 }; 277 s = (prec ? toFixedFix(n, prec) : "" + Math.round(n)).split("."); 278 if(s[0].length > 3) { 279 s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); 280 } 281 if((s[1] || "").length < prec) { 282 s[1] = s[1] || ""; 283 s[1] += new Array(prec - s[1].length + 1).join("0"); 284 } 285 return s.join(dec); 286} 287 288function couponCreate(couponBlock, oneCoupon) { 289 var couponClass = 'disabled'; 290 291 if(!BX.type.isElementNode(couponBlock)) 292 return; 293 if(oneCoupon.JS_STATUS === 'BAD') 294 couponClass = 'bad'; 295 else if(oneCoupon.JS_STATUS === 'APPLYED') 296 couponClass = 'good'; 297 298 couponBlock.appendChild(BX.create( 299 'div', 300 { 301 props: { 302 className: 'bx_ordercart_coupon' 303 }, 304 children: [ 305 BX.create( 306 'input', 307 { 308 props: { 309 type: 'hidden', 310 value: oneCoupon.COUPON, 311 name: 'OLD_COUPON[]' 312 } 313 } 314 ), 315 BX.create( 316 'div', 317 { 318 props: { 319 className: 'old_coupon ' + couponClass 320 }, 321 html: oneCoupon.COUPON + ' ' + oneCoupon.JS_CHECK_CODE 322 } 323 ), 324 BX.create( 325 'span', 326 { 327 props: { 328 className: 'close' 329 }, 330 attrs: { 331 'data-coupon': oneCoupon.COUPON 332 }, 333 children: [ 334 BX.create( 335 'i', 336 { 337 props: { 338 className: 'fa fa-times' 339 } 340 } 341 ) 342 ] 343 } 344 ), 345 BX.create( 346 'div', 347 { 348 props: { 349 className: 'clr' 350 } 351 } 352 ) 353 ] 354 } 355 )); 356} 357 358function couponListUpdate(res) { 359 var couponBlock, 360 fieldCoupon, 361 couponsCollection, 362 couponFound, 363 divCoupon, 364 i, 365 j, 366 key; 367 368 if(!!res && typeof res !== 'object') { 369 return; 370 } 371 372 couponBlock = BX('cart-coupon'); 373 if(!!couponBlock) { 374 if(!!res.COUPON_LIST && BX.type.isArray(res.COUPON_LIST)) { 375 fieldCoupon = BX('coupon'); 376 if(!!fieldCoupon) { 377 fieldCoupon.value = ''; 378 } 379 couponsCollection = BX.findChildren(couponBlock, { tagName: 'input', property: { name: 'OLD_COUPON[]' } }, true); 380 381 if(!!couponsCollection) { 382 if(BX.type.isElementNode(couponsCollection)) { 383 couponsCollection = [couponsCollection]; 384 } 385 for(i = 0; i < res.COUPON_LIST.length; i++) { 386 couponFound = false; 387 key = -1; 388 for(j = 0; j < couponsCollection.length; j++) { 389 if(couponsCollection[j].value === res.COUPON_LIST[i].COUPON) { 390 couponFound = true; 391 key = j; 392 couponsCollection[j].couponUpdate = true; 393 break; 394 } 395 } 396 if(couponFound) { 397 couponClass = 'disabled'; 398 if(res.COUPON_LIST[i].JS_STATUS === 'BAD') 399 couponClass = 'bad'; 400 else if(res.COUPON_LIST[i].JS_STATUS === 'APPLYED') 401 couponClass = 'good'; 402 divCoupon = BX.findNextSibling(couponsCollection[key], {className: 'old_coupon'}); 403 if(!!divCoupon) 404 BX.adjust(divCoupon, { 405 props: { 406 className: 'old_coupon ' + couponClass 407 }, 408 html: res.COUPON_LIST[i].COUPON + ' ' + res.COUPON_LIST[i].JS_CHECK_CODE 409 }); 410 } else { 411 couponCreate(couponBlock, res.COUPON_LIST[i]); 412 } 413 } 414 for(j = 0; j < couponsCollection.length; j++) { 415 if(typeof (couponsCollection[j].couponUpdate) === 'undefined' || !couponsCollection[j].couponUpdate) { 416 BX.remove(couponsCollection[j].parentNode); 417 couponsCollection[j] = null; 418 } else { 419 couponsCollection[j].couponUpdate = null; 420 } 421 } 422 } else { 423 for(i = 0; i < res.COUPON_LIST.length; i++) { 424 couponCreate(couponBlock, res.COUPON_LIST[i]); 425 } 426 } 427 } 428 } 429 couponBlock = null; 430} 431 432function checkOut() { 433 if(!!BX("coupon")) 434 BX("coupon").disabled = true; 435 BX("basket_form").submit(); 436 return true; 437} 438 439function enterCoupon() { 440 var newCoupon = BX("coupon"); 441 if(!!newCoupon && !!newCoupon.value) 442 recalcBasketAjax({"coupon" : newCoupon.value}); 443} 444 445function updateQuantity(controlId, basketId, ratio, bUseFloatQuantity) { 446 var oldVal = BX(controlId).defaultValue, 447 newVal = parseFloat(BX(controlId).value) || 0, 448 bIsCorrectQuantityForRatio = false, 449 autoCalculate = ((BX("auto_calculation") && BX("auto_calculation").value == "Y") || !BX("auto_calculation")); 450 451 if(ratio === 0 || ratio == 1) { 452 bIsCorrectQuantityForRatio = true; 453 } else { 454 var newValInt = newVal * 10000, 455 ratioInt = ratio * 10000, 456 reminder = newValInt % ratioInt, 457 newValRound = parseInt(newVal); 458 459 if(reminder === 0) { 460 bIsCorrectQuantityForRatio = true; 461 } 462 } 463 464 var bIsQuantityFloat = false; 465 466 if(parseInt(newVal) != parseFloat(newVal)) { 467 bIsQuantityFloat = true; 468 } 469 470 newVal = (bUseFloatQuantity === false && bIsQuantityFloat === false) ? parseInt(newVal) : parseFloat(newVal).toFixed(4); 471 newVal = correctQuantity(newVal); 472 473 if(bIsCorrectQuantityForRatio) { 474 BX(controlId).defaultValue = newVal; 475 476 BX("QUANTITY_INPUT_" + basketId).value = newVal; 477 478 //set hidden real quantity value (will be used in actual calculation) 479 BX("QUANTITY_" + basketId).value = newVal; 480 481 if(autoCalculate) { 482 basketPoolQuantity.changeQuantity(basketId); 483 } 484 } else { 485 newVal = getCorrectRatioQuantity(newVal, ratio, bUseFloatQuantity); 486 newVal = correctQuantity(newVal); 487 488 if(newVal != oldVal) { 489 BX("QUANTITY_INPUT_" + basketId).value = newVal; 490 BX("QUANTITY_" + basketId).value = newVal; 491 492 if(autoCalculate) { 493 basketPoolQuantity.changeQuantity(basketId); 494 } 495 } else { 496 BX(controlId).value = oldVal; 497 } 498 } 499} 500 501//used when quantity is changed by clicking on arrows 502function setQuantity(basketId, ratio, sign, bUseFloatQuantity) { 503 var curVal = parseFloat(BX("QUANTITY_INPUT_" + basketId).value), 504 newVal; 505 506 newVal = (sign == 'up') ? curVal + ratio : curVal - ratio; 507 508 if(newVal < 0) 509 newVal = 0; 510 511 if(bUseFloatQuantity) { 512 newVal = newVal.toFixed(4); 513 } 514 newVal = correctQuantity(newVal); 515 516 if(ratio > 0 && newVal < ratio) { 517 newVal = ratio; 518 } 519 520 if(!bUseFloatQuantity && newVal != newVal.toFixed(4)) { 521 newVal = newVal.toFixed(4); 522 } 523 524 newVal = getCorrectRatioQuantity(newVal, ratio, bUseFloatQuantity); 525 newVal = correctQuantity(newVal); 526 527 BX("QUANTITY_INPUT_" + basketId).value = newVal; 528 BX("QUANTITY_INPUT_" + basketId).defaultValue = newVal; 529 530 updateQuantity('QUANTITY_INPUT_' + basketId, basketId, ratio, bUseFloatQuantity); 531} 532 533function getCorrectRatioQuantity(quantity, ratio, bUseFloatQuantity) { 534 var newValInt = quantity * 10000, 535 ratioInt = ratio * 10000, 536 reminder = newValInt % ratioInt, 537 result = quantity, 538 bIsQuantityFloat = false, 539 i; 540 ratio = parseFloat(ratio); 541 542 if(reminder === 0) { 543 return result; 544 } 545 546 if(ratio !== 0 && ratio != 1) { 547 for(i = ratio, max = parseFloat(quantity) + parseFloat(ratio); i <= max; i = parseFloat(parseFloat(i) + parseFloat(ratio)).toFixed(4)) { 548 result = i; 549 } 550 } else if(ratio === 1) { 551 result = quantity | 0; 552 } 553 554 if(parseInt(result, 10) != parseFloat(result)) { 555 bIsQuantityFloat = true; 556 } 557 558 result = (bUseFloatQuantity === false && bIsQuantityFloat === false) ? parseInt(result, 10) : parseFloat(result).toFixed(4); 559 result = correctQuantity(result); 560 561 return result; 562} 563 564function correctQuantity(quantity) { 565 return parseFloat((quantity * 1).toString()); 566} 567 568function recalcBasketAjax(params) { 569 if(basketPoolQuantity.isProcessing()) { 570 return false; 571 } 572 573 BX.showWait(); 574 575 var property_values = {}, 576 action_var = BX('action_var').value, 577 items = BX.findChildren(BX('cart_equipment'), {className: 'tr'}, true), 578 shelveItems = BX.findChildren(BX('shelve_equipment'), {className: 'tr'}, true), 579 postData, 580 i; 581 582 postData = { 583 'sessid': BX.bitrix_sessid(), 584 'site_id': BX.message('SITE_ID'), 585 'props': property_values, 586 'action_var': action_var, 587 'select_props': BX('column_headers').value, 588 'offers_props': BX('offers_props').value, 589 'quantity_float': BX('quantity_float').value, 590 'count_discount_4_all_quantity': BX('count_discount_4_all_quantity').value, 591 'price_vat_show_value': BX('price_vat_show_value').value, 592 'hide_coupon': BX('hide_coupon').value, 593 'use_prepayment': BX('use_prepayment').value 594 }; 595 postData[action_var] = 'recalculate'; 596 if(!!params && typeof params === 'object') { 597 for(i in params) { 598 if(params.hasOwnProperty(i)) 599 postData[i] = params[i]; 600 } 601 } 602 603 if(!!items && items.length > 0) { 604 for(i = 0; items.length > i; i++) 605 postData['QUANTITY_' + items[i].id] = BX('QUANTITY_' + items[i].id).value; 606 } 607 608 if(!!shelveItems && shelveItems.length > 0) { 609 for(i = 0; shelveItems.length > i; i++) 610 postData['DELAY_' + shelveItems[i].id] = 'Y'; 611 } 612 613 basketPoolQuantity.setProcessing(true); 614 basketPoolQuantity.clearPool(); 615
616 BX.ajax({ 617 url: '/bitrix/components/bitrix/sale.basket.basket/ajax.php', 618 method: 'POST', 619 data: postData, 620 dataType: 'json', 621 onsuccess: function(result) { 622 BX.closeWait(); 623 basketPoolQuantity.setProcessing(false); 624 if(basketPoolQuantity.isPoolEmpty()) { 625 updateBasketTable(null, result); 626 basketPoolQuantity.updateQuantity(); 627 } else { 628 basketPoolQuantity.enableTimer(true); 629 } 630 } 631 }); 632} 633 634function showBasketItems(val) { 635 if(val == 2) { 636 BX("id-cart-list").style.display = 'none'; 637 BX("id-shelve-list").style.display = 'block'; 638 } else { 639 BX("id-cart-list").style.display = 'block'; 640 BX("id-shelve-list").style.display = 'none'; 641 } 642} 643 644function deleteCoupon(e) { 645 var target = BX.proxy_context, 646 value; 647 648 if(!!target && target.hasAttribute('data-coupon')) { 649 value = target.getAttribute('data-coupon'); 650 if(!!value && value.length > 0) { 651 recalcBasketAjax({'delete_coupon' : value}); 652 } 653 } 654} 655 656function openFormBoc() { 657 var action = "boc", 658 visualId = "cart"; 659 BX.PopupForm = 660 { 661 arParams: {} 662 }; 663 664 665 666 BX.PopupForm.popup = BX.PopupWindowManager.create(action + "_" + visualId, null, { 667 autoHide: true, 668 offsetLeft: 0, 669 offsetTop: 0, 670 overlay: { 671 opacity: 100 672 }, 673 draggable: false, 674 closeByEsc: false, 675 className: "pop-up forms short", 676 closeIcon: { right : "-10px", top : "-10px"}, 677 titleBar: true, 678 content: "<div class='popup-window-wait'><i class='fa fa-spinner fa-pulse'></i></div>", 679 events: { 680 onAfterPopupShow: function() 681 { 682 if(!BX(action + "_" + visualId + "_form")) { 683 BX.ajax.post( 684 BX.message("SITE_DIR") + "ajax/popup.php", 685 { 686 sessid: BX.bitrix_sessid(), 687 action: action, 688 arParams: BX.message("SBB_COMPONENT_PARAMS"), 689 ELEMENT_AREA_ID: visualId 690 }, 691 BX.delegate(function(result) 692 { 693 this.setContent(result); 694 var windowSize = BX.GetWindowInnerSize(), 695 windowScroll = BX.GetWindowScrollPos(), 696 popupHeight = BX(action + "_" + visualId).offsetHeight; 697 BX(action + "_" + visualId).style.top = windowSize.innerHeight/2 - popupHeight/2 + windowScroll.scrollTop + "px"; 698 }, 699 this) 700 ); 701 } 702 } 703 } 704 }); 705 706 var close = BX.findChild(BX(action + "_" + visualId), {className: "popup-window-close-icon"}, true, false); 707 if(!!close) 708 close.innerHTML = "<i class='fa fa-times'></i>"; 709 710 BX.PopupForm.popup.show(); 711} 712 713BX.ready(function() { 714 basketPoolQuantity = new BasketPoolQuantity(); 715 var couponBlock = BX('cart-coupon'); 716 if(!!couponBlock) 717 BX.bindDelegate(couponBlock, 'click', { 'attribute': 'data-coupon' }, BX.delegate(function(e){deleteCoupon(e); }, this)); 718 719 var bocBtn = BX("boc_anch_cart"); 720 if(!!bocBtn) 721 BX.bind(bocBtn, "click", BX.delegate(function(){openFormBoc();}, this)); 722});
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.