1(function (window) 2{ 3if (!!window.JCCatalogTopSection) 4{ 5 return; 6} 7 8var BasketButton = function(params) 9{ 10 BasketButton.superclass.constructor.apply(this, arguments); 11 this.nameNode = BX.create('span', { 12 props : { className : 'bx_medium bx_bt_button', id : this.id }, 13 style: typeof(params.style) === 'object' ? params.style : {}, 14 text: params.text 15 }); 16 this.buttonNode = BX.create('span', { 17 attrs: { className: params.ownerClass }, 18 style: { marginBottom: '0', borderBottom: '0 none transparent' }, 19 children: [this.nameNode], 20 events : this.contextEvents 21 }); 22 if (BX.browser.IsIE()) 23 { 24 this.buttonNode.setAttribute("hideFocus", "hidefocus"); 25 } 26}; 27BX.extend(BasketButton, BX.PopupWindowButton); 28 29window.JCCatalogTopSection = function (arParams) 30{ 31 this.productType = 0; 32 this.showQuantity = true; 33 this.showAbsent = true; 34 this.secondPict = false; 35 this.showOldPrice = false; 36 this.showPercent = false; 37 this.showSkuProps = false; 38 this.basketAction = 'ADD'; 39 this.showClosePopup = false; 40 this.useCompare = false; 41 this.visual = { 42 ID: '', 43 PICT_ID: '', 44 SECOND_PICT_ID: '', 45 QUANTITY_ID: '', 46 QUANTITY_UP_ID: '', 47 QUANTITY_DOWN_ID: '', 48 PRICE_ID: '', 49 DSC_PERC: '', 50 SECOND_DSC_PERC: '', 51 DISPLAY_PROP_DIV: '' 52 }; 53 this.product = { 54 checkQuantity: false, 55 maxQuantity: 0, 56 stepQuantity: 1, 57 isDblQuantity: false, 58 canBuy: true, 59 canSubscription: true, 60 name: '', 61 pict: {}, 62 id: 0, 63 addUrl: '', 64 buyUrl: '' 65 }; 66 67 this.basketMode = ''; 68 this.basketData = { 69 useProps: false, 70 emptyProps: false, 71 quantity: 'quantity', 72 props: 'prop', 73 basketUrl: '', 74 sku_props: '', 75 sku_props_var: 'basket_props', 76 add_url: '', 77 buy_url: '' 78 }; 79 80 this.compareData = { 81 compareUrl: '', 82 comparePath: '' 83 }; 84 85 this.defaultPict = { 86 pict: null, 87 secondPict: null 88 }; 89 90 this.checkQuantity = false; 91 this.maxQuantity = 0; 92 this.stepQuantity = 1; 93 this.isDblQuantity = false; 94 this.canBuy = true; 95 this.currentBasisPrice = {}; 96 this.canSubscription = true; 97 this.precision = 6; 98 this.precisionFactor = Math.pow(10,this.precision); 99 100 this.offers = []; 101 this.offerNum = 0; 102 this.treeProps = []; 103 this.obTreeRows = []; 104 this.showCount = []; 105 this.showStart = []; 106 this.selectedValues = {}; 107 108 this.obProduct = null; 109 this.obQuantity = null; 110 this.obQuantityUp = null; 111 this.obQuantityDown = null; 112 this.obPict = null; 113 this.obSecondPict = null; 114 this.obPrice = null; 115 this.obTree = null; 116 this.obBuyBtn = null; 117 this.obBasketActions = null; 118 this.obNotAvail = null; 119 this.obDscPerc = null; 120 this.obSecondDscPerc = null; 121 this.obSkuProps = null; 122 this.obMeasure = null; 123 this.obCompare = null; 124 125 this.treeRowShowSize = 5; 126 this.treeEnableArrow = { display: '', cursor: 'pointer', opacity: 1 }; 127 this.treeDisableArrow = { display: '', cursor: 'default', opacity:0.2 }; 128 129 this.lastElement = false; 130 this.containerHeight = 0; 131 132 this.errorCode = 0; 133 134 if ('object' === typeof arParams) 135 { 136 this.productType = parseInt(arParams.PRODUCT_TYPE, 10); 137 this.showQuantity = arParams.SHOW_QUANTITY; 138 this.showAbsent = arParams.SHOW_ABSENT; 139 this.secondPict = !!arParams.SECOND_PICT; 140 this.showOldPrice = !!arParams.SHOW_OLD_PRICE; 141 this.showPercent = !!arParams.SHOW_DISCOUNT_PERCENT; 142 this.showSkuProps = !!arParams.SHOW_SKU_PROPS; 143 if (!!arParams.ADD_TO_BASKET_ACTION) 144 { 145 this.basketAction = arParams.ADD_TO_BASKET_ACTION; 146 } 147 this.showClosePopup = !!arParams.SHOW_CLOSE_POPUP; 148 this.useCompare = !!arParams.DISPLAY_COMPARE; 149 150 this.visual = arParams.VISUAL; 151 152 switch (this.productType) 153 { 154 case 1://product 155 case 2://set 156 if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT)) 157 { 158 if (this.showQuantity) 159 { 160 this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY; 161 this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT; 162 if (this.product.checkQuantity) 163 { 164 this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10)); 165 } 166 this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10)); 167 168 this.checkQuantity = this.product.checkQuantity; 169 this.isDblQuantity = this.product.isDblQuantity; 170 this.maxQuantity = this.product.maxQuantity; 171 this.stepQuantity = this.product.stepQuantity; 172 if (this.isDblQuantity) 173 { 174 this.stepQuantity = Math.round(this.stepQuantity*this.precisionFactor)/this.precisionFactor; 175 } 176 }
177 this.product.canBuy = arParams.PRODUCT.CAN_BUY; 178 this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION; 179 if (!!arParams.PRODUCT.BASIS_PRICE) 180 { 181 this.currentBasisPrice = arParams.PRODUCT.BASIS_PRICE; 182 } 183 184 this.canBuy = this.product.canBuy; 185 this.canSubscription = this.product.canSubscription; 186 187 this.product.name = arParams.PRODUCT.NAME; 188 this.product.pict = arParams.PRODUCT.PICT; 189 this.product.id = arParams.PRODUCT.ID; 190 if (!!arParams.PRODUCT.ADD_URL) 191 { 192 this.product.addUrl = arParams.PRODUCT.ADD_URL; 193 } 194 if (!!arParams.PRODUCT.BUY_URL) 195 { 196 this.product.buyUrl = arParams.PRODUCT.BUY_URL; 197 } 198 if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET)) 199 { 200 this.basketData.useProps = !!arParams.BASKET.ADD_PROPS; 201 this.basketData.emptyProps = !!arParams.BASKET.EMPTY_PROPS; 202 } 203 } 204 else 205 { 206 this.errorCode = -1; 207 } 208 break; 209 case 3://sku 210 if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS)) 211 { 212 this.product.name = arParams.PRODUCT.NAME; 213 this.product.id = arParams.PRODUCT.ID; 214 this.offers = arParams.OFFERS; 215 this.offerNum = 0; 216 if (!!arParams.OFFER_SELECTED) 217 { 218 this.offerNum = parseInt(arParams.OFFER_SELECTED, 10); 219 } 220 if (isNaN(this.offerNum)) 221 { 222 this.offerNum = 0; 223 } 224 if (!!arParams.TREE_PROPS) 225 { 226 this.treeProps = arParams.TREE_PROPS; 227 } 228 if (!!arParams.DEFAULT_PICTURE) 229 { 230 this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE; 231 this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND; 232 } 233 } 234 break; 235 default: 236 this.errorCode = -1; 237 } 238 if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET)) 239 { 240 if (!!arParams.BASKET.QUANTITY) 241 { 242 this.basketData.quantity = arParams.BASKET.QUANTITY; 243 } 244 if (!!arParams.BASKET.PROPS) 245 { 246 this.basketData.props = arParams.BASKET.PROPS; 247 } 248 if (!!arParams.BASKET.BASKET_URL) 249 { 250 this.basketData.basketUrl = arParams.BASKET.BASKET_URL; 251 } 252 if (3 === this.productType) 253 { 254 if (!!arParams.BASKET.SKU_PROPS) 255 { 256 this.basketData.sku_props = arParams.BASKET.SKU_PROPS; 257 } 258 } 259 if (!!arParams.BASKET.ADD_URL_TEMPLATE) 260 { 261 this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE; 262 } 263 if (!!arParams.BASKET.BUY_URL_TEMPLATE) 264 { 265 this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE; 266 } 267 if (this.basketData.add_url === '' && this.basketData.buy_url === '') 268 { 269 this.errorCode = -1024; 270 } 271 } 272 if (this.useCompare) 273 { 274 if (!!arParams.COMPARE && typeof(arParams.COMPARE) === 'object') 275 { 276 if (!!arParams.COMPARE.COMPARE_PATH) 277 { 278 this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH; 279 } 280 if (!!arParams.COMPARE.COMPARE_URL_TEMPLATE) 281 { 282 this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE; 283 } 284 else 285 { 286 this.useCompare = false; 287 } 288 } 289 else 290 { 291 this.useCompare = false; 292 } 293 } 294 this.lastElement = (!!arParams.LAST_ELEMENT && 'Y' === arParams.LAST_ELEMENT); 295 } 296 if (0 === this.errorCode) 297 { 298 BX.ready(BX.delegate(this.Init,this)); 299 } 300}; 301 302window.JCCatalogTopSection.prototype.Init = function() 303{ 304 var i = 0, 305 strPrefix = '', 306 TreeItems = null; 307 308 this.obProduct = BX(this.visual.ID); 309 if (!this.obProduct) 310 { 311 this.errorCode = -1; 312 } 313 this.obPict = BX(this.visual.PICT_ID); 314 if (!this.obPict) 315 { 316 this.errorCode = -2; 317 } 318 if (this.secondPict && !!this.visual.SECOND_PICT_ID) 319 { 320 this.obSecondPict = BX(this.visual.SECOND_PICT_ID); 321 } 322 this.obPrice = BX(this.visual.PRICE_ID); 323 if (!this.obPrice) 324 { 325 this.errorCode = -16; 326 } 327 if (this.showQuantity && !!this.visual.QUANTITY_ID) 328 { 329 this.obQuantity = BX(this.visual.QUANTITY_ID); 330 if (!!this.visual.QUANTITY_UP_ID) 331 { 332 this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID); 333 } 334 if (!!this.visual.QUANTITY_DOWN_ID) 335 { 336 this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID); 337 } 338 } 339 if (3 === this.productType && this.offers.length > 0) 340 { 341 if (!!this.visual.TREE_ID) 342 { 343 this.obTree = BX(this.visual.TREE_ID); 344 if (!this.obTree) 345 { 346 this.errorCode = -256; 347 } 348 strPrefix = this.visual.TREE_ITEM_ID; 349 for (i = 0; i < this.treeProps.length; i++) 350 { 351 this.obTreeRows[i] = { 352 LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'), 353 RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'), 354 LIST: BX(strPrefix+this.treeProps[i].ID+'_list'), 355 CONT: BX(strPrefix+this.treeProps[i].ID+'_cont') 356 }; 357 if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT) 358 { 359 this.errorCode = -512; 360 break; 361 } 362 } 363 } 364 if (!!this.visual.QUANTITY_MEASURE) 365 { 366 this.obMeasure = BX(this.visual.QUANTITY_MEASURE); 367 } 368 } 369 this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID); 370 if (!!this.obBasketActions) 371 { 372 if (!!this.visual.BUY_ID) 373 { 374 this.obBuyBtn = BX(this.visual.BUY_ID); 375 } 376 } 377 this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS); 378 379 if (this.showPercent) 380 { 381 if (!!this.visual.DSC_PERC) 382 { 383 this.obDscPerc = BX(this.visual.DSC_PERC); 384 } 385 if (this.secondPict && !!this.visual.SECOND_DSC_PERC) 386 { 387 this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC); 388 } 389 } 390 391 if (this.showSkuProps) 392 { 393 if (!!this.visual.DISPLAY_PROP_DIV) 394 { 395 this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV); 396 } 397 } 398 399 if (0 === this.errorCode) 400 { 401 if (this.showQuantity) 402 { 403 if (!!this.obQuantityUp) 404 { 405 BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this)); 406 } 407 if (!!this.obQuantityDown) 408 { 409 BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this)); 410 } 411 if (!!this.obQuantity) 412 { 413 BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this)); 414 } 415 } 416 switch (this.productType) 417 { 418 case 1://product 419 break; 420 case 3://sku 421 if (this.offers.length > 0) 422 { 423 TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true); 424 if (!!TreeItems && 0 < TreeItems.length) 425 { 426 for (i = 0; i < TreeItems.length; i++) 427 { 428 BX.bind(TreeItems[i], 'click', BX.delegate(this.SelectOfferProp, this)); 429 } 430 } 431 for (i = 0; i < this.obTreeRows.length; i++) 432 { 433 BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(this.RowLeft, this)); 434 BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(this.RowRight, this)); 435 } 436 this.SetCurrent(); 437 } 438 break; 439 } 440 if (!!this.obBuyBtn) 441 { 442 if (this.basketAction === 'ADD') 443 { 444 BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Add2Basket, this)); 445 } 446 else 447 {
448 BX.bind(this.obBuyBtn, 'click', BX.delegate(this.BuyBasket, this)); 449 } 450 } 451 if (this.lastElement) 452 { 453 this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10); 454 if (isNaN(this.containerHeight)) 455 { 456 this.containerHeight = 0; 457 } 458 this.setHeight(); 459 BX.bind(window, 'resize', BX.delegate(this.checkHeight, this)); 460 BX.bind(this.obProduct.parentNode, 'mouseover', BX.delegate(this.setHeight, this)); 461 BX.bind(this.obProduct.parentNode, 'mouseout', BX.delegate(this.clearHeight, this)); 462 } 463 if (this.useCompare) 464 { 465 this.obCompare = BX(this.visual.COMPARE_LINK_ID); 466 if (!!this.obCompare) 467 { 468 BX.bind(this.obCompare, 'click', BX.proxy(this.Compare, this)); 469 } 470 } 471 } 472}; 473 474window.JCCatalogTopSection.prototype.checkHeight = function() 475{ 476 this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10); 477 if (isNaN(this.containerHeight)) 478 { 479 this.containerHeight = 0; 480 } 481}; 482 483window.JCCatalogTopSection.prototype.setHeight = function() 484{ 485 if (0 < this.containerHeight) 486 { 487 BX.adjust(this.obProduct.parentNode, {style: { height: this.containerHeight+'px'}}); 488 } 489}; 490 491window.JCCatalogTopSection.prototype.clearHeight = function() 492{ 493 BX.adjust(this.obProduct.parentNode, {style: { height: 'auto'}}); 494}; 495 496window.JCCatalogTopSection.prototype.QuantityUp = function() 497{ 498 var curValue = 0, 499 boolSet = true, 500 calcPrice; 501 502 if (0 === this.errorCode && this.showQuantity && this.canBuy) 503 { 504 curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10)); 505 if (!isNaN(curValue)) 506 { 507 curValue += this.stepQuantity; 508 if (this.checkQuantity) 509 { 510 if (curValue > this.maxQuantity) 511 { 512 boolSet = false; 513 } 514 } 515 if (boolSet) 516 { 517 if (this.isDblQuantity) 518 { 519 curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor; 520 } 521 this.obQuantity.value = curValue; 522 calcPrice = { 523 DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue, 524 VALUE: this.currentBasisPrice.VALUE * curValue, 525 DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue, 526 DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT, 527 CURRENCY: this.currentBasisPrice.CURRENCY 528 }; 529 this.setPrice(calcPrice); 530 } 531 } 532 } 533}; 534 535window.JCCatalogTopSection.prototype.QuantityDown = function() 536{ 537 var curValue = 0, 538 boolSet = true, 539 calcPrice; 540 541 if (0 === this.errorCode && this.showQuantity && this.canBuy) 542 { 543 curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value): parseInt(this.obQuantity.value, 10)); 544 if (!isNaN(curValue)) 545 { 546 curValue -= this.stepQuantity; 547 if (curValue < this.stepQuantity) 548 { 549 boolSet = false; 550 } 551 if (boolSet) 552 { 553 if (this.isDblQuantity) 554 { 555 curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor; 556 } 557 this.obQuantity.value = curValue; 558 calcPrice = { 559 DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * curValue, 560 VALUE: this.currentBasisPrice.VALUE * curValue, 561 DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * curValue, 562 DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT, 563 CURRENCY: this.currentBasisPrice.CURRENCY 564 }; 565 this.setPrice(calcPrice); 566 } 567 } 568 } 569}; 570 571window.JCCatalogTopSection.prototype.QuantityChange = function() 572{ 573 var curValue = 0, 574 calcPrice, 575 intCount, 576 count; 577 578 if (0 === this.errorCode && this.showQuantity) 579 { 580 if (this.canBuy) 581 { 582 curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10)); 583 if (!isNaN(curValue)) 584 { 585 if (this.checkQuantity) 586 { 587 if (curValue > this.maxQuantity) 588 { 589 curValue = this.maxQuantity; 590 } 591 } 592 if (curValue < this.stepQuantity) 593 { 594 curValue = this.stepQuantity; 595 } 596 else 597 { 598 count = Math.round((curValue*this.precisionFactor)/this.stepQuantity)/this.precisionFactor; 599 intCount = parseInt(count, 10); 600 if (isNaN(intCount)) 601 { 602 intCount = 1; 603 count = 1.1; 604 } 605 if (count > intCount) 606 { 607 curValue = (intCount <= 1 ? this.stepQuantity : intCount*this.stepQuantity); 608 curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor; 609 } 610 } 611 this.obQuantity.value = curValue; 612 } 613 else 614 {
615 this.obQuantity.value = this.stepQuantity; 616 } 617 } 618 else 619 { 620 this.obQuantity.value = this.stepQuantity; 621 } 622 calcPrice = { 623 DISCOUNT_VALUE: this.currentBasisPrice.DISCOUNT_VALUE * this.obQuantity.value, 624 VALUE: this.currentBasisPrice.VALUE * this.obQuantity.value, 625 DISCOUNT_DIFF: this.currentBasisPrice.DISCOUNT_DIFF * this.obQuantity.value, 626 DISCOUNT_DIFF_PERCENT: this.currentBasisPrice.DISCOUNT_DIFF_PERCENT, 627 CURRENCY: this.currentBasisPrice.CURRENCY 628 }; 629 this.setPrice(calcPrice); 630 } 631}; 632 633window.JCCatalogTopSection.prototype.QuantitySet = function(index) 634{ 635 if (0 === this.errorCode) 636 { 637 this.canBuy = this.offers[index].CAN_BUY; 638 if (this.canBuy) 639 { 640 if (!!this.obBasketActions) 641 { 642 BX.style(this.obBasketActions, 'display', ''); 643 } 644 if (!!this.obNotAvail) 645 { 646 BX.style(this.obNotAvail, 'display', 'none'); 647 } 648 } 649 else 650 { 651 if (!!this.obBasketActions) 652 { 653 BX.style(this.obBasketActions, 'display', 'none'); 654 } 655 if (!!this.obNotAvail) 656 { 657 BX.style(this.obNotAvail, 'display', ''); 658 } 659 } 660 if (this.showQuantity) 661 { 662 this.isDblQuantity = this.offers[index].QUANTITY_FLOAT; 663 this.checkQuantity = this.offers[index].CHECK_QUANTITY; 664 if (this.isDblQuantity) 665 { 666 this.maxQuantity = parseFloat(this.offers[index].MAX_QUANTITY); 667 this.stepQuantity = Math.round(parseFloat(this.offers[index].STEP_QUANTITY)*this.precisionFactor)/this.precisionFactor; 668 } 669 else 670 { 671 this.maxQuantity = parseInt(this.offers[index].MAX_QUANTITY, 10); 672 this.stepQuantity = parseInt(this.offers[index].STEP_QUANTITY, 10); 673 } 674 675 this.obQuantity.value = this.stepQuantity; 676 this.obQuantity.disabled = !this.canBuy; 677 if (!!this.obMeasure) 678 { 679 if (!!this.offers[index].MEASURE) 680 { 681 BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE}); 682 } 683 else 684 { 685 BX.adjust(this.obMeasure, { html : ''}); 686 } 687 } 688 } 689 this.currentBasisPrice = this.offers[index].BASIS_PRICE; 690 } 691}; 692 693window.JCCatalogTopSection.prototype.SelectOfferProp = function() 694{ 695 var i = 0, 696 value = '', 697 strTreeValue = '', 698 arTreeItem = [], 699 RowItems = null, 700 target = BX.proxy_context; 701 702 if (!!target && target.hasAttribute('data-treevalue')) 703 { 704 strTreeValue = target.getAttribute('data-treevalue'); 705 arTreeItem = strTreeValue.split('_'); 706 if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1])) 707 { 708 RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false); 709 if (!!RowItems && 0 < RowItems.length) 710 { 711 for (i = 0; i < RowItems.length; i++) 712 { 713 value = RowItems[i].getAttribute('data-onevalue'); 714 if (value === arTreeItem[1]) 715 { 716 BX.addClass(RowItems[i], 'bx_active'); 717 } 718 else 719 { 720 BX.removeClass(RowItems[i], 'bx_active'); 721 } 722 } 723 } 724 } 725 } 726}; 727 728window.JCCatalogTopSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue) 729{ 730 var strName = '', 731 arShowValues = false, 732 i, j, 733 arCanBuyValues = [], 734 index = -1, 735 arFilter = {}, 736 tmpFilter = []; 737 738 for (i = 0; i < this.treeProps.length; i++) 739 { 740 if (this.treeProps[i].ID === strPropID) 741 { 742 index = i; 743 break; 744 } 745 } 746 747 if (-1 < index) 748 { 749 for (i = 0; i < index; i++) 750 { 751 strName = 'PROP_'+this.treeProps[i].ID; 752 arFilter[strName] = this.selectedValues[strName]; 753 } 754 strName = 'PROP_'+this.treeProps[index].ID; 755 arShowValues = this.GetRowValues(arFilter, strName); 756 if (!arShowValues) 757 { 758 return false; 759 } 760 if (!BX.util.in_array(strPropValue, arShowValues)) 761 { 762 return false; 763 } 764 arFilter[strName] = strPropValue; 765 for (i = index+1; i < this.treeProps.length; i++) 766 { 767 strName = 'PROP_'+this.treeProps[i].ID; 768 arShowValues = this.GetRowValues(arFilter, strName); 769 if (!arShowValues) 770 { 771 return false; 772 } 773 if (this.showAbsent) 774 { 775 arCanBuyValues = []; 776 tmpFilter = []; 777 tmpFilter = BX.clone(arFilter, true); 778 for (j = 0; j < arShowValues.length; j++) 779 { 780 tmpFilter[strName] = arShowValues[j]; 781 if (this.GetCanBuy(tmpFilter)) 782 { 783 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 784 } 785 } 786 } 787 else 788 {
789 arCanBuyValues = arShowValues; 790 } 791 if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues)) 792 { 793 arFilter[strName] = this.selectedValues[strName]; 794 } 795 else 796 { 797 arFilter[strName] = arCanBuyValues[0]; 798 } 799 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 800 } 801 this.selectedValues = arFilter; 802 this.ChangeInfo(); 803 } 804 return true; 805}; 806 807window.JCCatalogTopSection.prototype.RowLeft = function() 808{ 809 var i = 0, 810 strTreeValue = '', 811 index = -1, 812 target = BX.proxy_context; 813 814 if (!!target && target.hasAttribute('data-treevalue')) 815 { 816 strTreeValue = target.getAttribute('data-treevalue'); 817 for (i = 0; i < this.treeProps.length; i++) 818 { 819 if (this.treeProps[i].ID === strTreeValue) 820 { 821 index = i; 822 break; 823 } 824 } 825 if (-1 < index && this.treeRowShowSize < this.showCount[index]) 826 { 827 if (0 > this.showStart[index]) 828 { 829 this.showStart[index]++; 830 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 831 BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeEnableArrow }); 832 } 833 834 if (0 <= this.showStart[index]) 835 { 836 BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeDisableArrow }); 837 } 838 } 839 } 840}; 841 842window.JCCatalogTopSection.prototype.RowRight = function() 843{ 844 var i = 0, 845 strTreeValue = '', 846 index = -1, 847 target = BX.proxy_context; 848 849 if (!!target && target.hasAttribute('data-treevalue')) 850 { 851 strTreeValue = target.getAttribute('data-treevalue'); 852 for (i = 0; i < this.treeProps.length; i++) 853 { 854 if (this.treeProps[i].ID === strTreeValue) 855 { 856 index = i; 857 break; 858 } 859 } 860 if (-1 < index && this.treeRowShowSize < this.showCount[index]) 861 { 862 if ((this.treeRowShowSize - this.showStart[index]) < this.showCount[index]) 863 { 864 this.showStart[index]--; 865 BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }}); 866 BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeEnableArrow }); 867 } 868 869 if ((this.treeRowShowSize - this.showStart[index]) >= this.showCount[index]) 870 { 871 BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeDisableArrow }); 872 } 873 } 874 } 875}; 876 877window.JCCatalogTopSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID) 878{ 879 var i = 0, 880 showI = 0, 881 value = '', 882 countShow = 0, 883 strNewLen = '', 884 obData = {}, 885 pictMode = false, 886 extShowMode = false, 887 isCurrent = false, 888 selectIndex = 0, 889 obLeft = this.treeEnableArrow, 890 obRight = this.treeEnableArrow, 891 currentShowStart = 0, 892 RowItems = null; 893 894 if (-1 < intNumber && intNumber < this.obTreeRows.length) 895 { 896 RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false); 897 if (!!RowItems && 0 < RowItems.length) 898 { 899 pictMode = ('PICT' === this.treeProps[intNumber].SHOW_MODE); 900 countShow = showID.length; 901 extShowMode = this.treeRowShowSize < countShow; 902 strNewLen = (extShowMode ? (100/countShow)+'%' : '20%'); 903 obData = { 904 props: { className: '' }, 905 style: { 906 width: strNewLen 907 } 908 }; 909 if (pictMode) 910 { 911 obData.style.paddingTop = strNewLen; 912 } 913 for (i = 0; i < RowItems.length; i++) 914 { 915 value = RowItems[i].getAttribute('data-onevalue'); 916 isCurrent = (value === activeID); 917 if (BX.util.in_array(value, canBuyID)) 918 { 919 obData.props.className = (isCurrent ? 'bx_active' : ''); 920 } 921 else 922 { 923 obData.props.className = (isCurrent ? 'bx_active bx_missing' : 'bx_missing'); 924 } 925 obData.style.display = 'none'; 926 if (BX.util.in_array(value, showID)) 927 { 928 obData.style.display = ''; 929 if (isCurrent) 930 { 931 selectIndex = showI; 932 } 933 showI++; 934 } 935 BX.adjust(RowItems[i], obData); 936 } 937 938 obData = { 939 style: { 940 width: (extShowMode ? 20*countShow : 100)+'%', 941 marginLeft: '0%' 942 } 943 }; 944 if (pictMode) 945 { 946 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}}); 947 } 948 else 949 { 950 BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_size full' : 'bx_item_detail_size')}}); 951 } 952 if (extShowMode) 953 { 954 if (selectIndex +1 === countShow) 955 { 956 obRight = this.treeDisableArrow; 957 } 958 if (this.treeRowShowSize <= selectIndex) 959 { 960 currentShowStart = this.treeRowShowSize - selectIndex - 1; 961 obData.style.marginLeft = currentShowStart*20+'%'; 962 } 963 if (0 === currentShowStart) 964 { 965 obLeft = this.treeDisableArrow; 966 } 967 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: obLeft }); 968 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: obRight }); 969 } 970 else 971 {
972 BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}}); 973 BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}}); 974 } 975 BX.adjust(this.obTreeRows[intNumber].LIST, obData); 976 this.showCount[intNumber] = countShow; 977 this.showStart[intNumber] = currentShowStart; 978 } 979 } 980}; 981 982window.JCCatalogTopSection.prototype.GetRowValues = function(arFilter, index) 983{ 984 var i = 0, 985 j, 986 arValues = [], 987 boolSearch = false, 988 boolOneSearch = true; 989 990 if (0 === arFilter.length) 991 { 992 for (i = 0; i < this.offers.length; i++) 993 { 994 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 995 { 996 arValues[arValues.length] = this.offers[i].TREE[index]; 997 } 998 } 999 boolSearch = true; 1000 } 1001 else 1002 { 1003 for (i = 0; i < this.offers.length; i++) 1004 { 1005 boolOneSearch = true; 1006 for (j in arFilter) 1007 { 1008 if (arFilter[j] !== this.offers[i].TREE[j]) 1009 { 1010 boolOneSearch = false; 1011 break; 1012 } 1013 } 1014 if (boolOneSearch) 1015 { 1016 if (!BX.util.in_array(this.offers[i].TREE[index], arValues)) 1017 { 1018 arValues[arValues.length] = this.offers[i].TREE[index]; 1019 } 1020 boolSearch = true; 1021 } 1022 } 1023 } 1024 return (boolSearch ? arValues : false); 1025}; 1026 1027window.JCCatalogTopSection.prototype.GetCanBuy = function(arFilter) 1028{ 1029 var i = 0, 1030 j, 1031 boolSearch = false, 1032 boolOneSearch = true; 1033 1034 for (i = 0; i < this.offers.length; i++) 1035 { 1036 boolOneSearch = true; 1037 for (j in arFilter) 1038 { 1039 if (arFilter[j] !== this.offers[i].TREE[j]) 1040 { 1041 boolOneSearch = false; 1042 break; 1043 } 1044 } 1045 if (boolOneSearch) 1046 { 1047 if (this.offers[i].CAN_BUY) 1048 { 1049 boolSearch = true; 1050 break; 1051 } 1052 } 1053 } 1054 return boolSearch; 1055}; 1056 1057window.JCCatalogTopSection.prototype.SetCurrent = function() 1058{ 1059 var i = 0, 1060 j = 0, 1061 arCanBuyValues = [], 1062 strName = '', 1063 arShowValues = false, 1064 arFilter = {}, 1065 tmpFilter = [], 1066 current = this.offers[this.offerNum].TREE; 1067 1068 for (i = 0; i < this.treeProps.length; i++) 1069 { 1070 strName = 'PROP_'+this.treeProps[i].ID; 1071 arShowValues = this.GetRowValues(arFilter, strName); 1072 if (!arShowValues) 1073 { 1074 break; 1075 } 1076 if (BX.util.in_array(current[strName], arShowValues)) 1077 { 1078 arFilter[strName] = current[strName]; 1079 } 1080 else 1081 { 1082 arFilter[strName] = arShowValues[0]; 1083 this.offerNum = 0; 1084 } 1085 if (this.showAbsent) 1086 { 1087 arCanBuyValues = []; 1088 tmpFilter = []; 1089 tmpFilter = BX.clone(arFilter, true); 1090 for (j = 0; j < arShowValues.length; j++) 1091 { 1092 tmpFilter[strName] = arShowValues[j]; 1093 if (this.GetCanBuy(tmpFilter)) 1094 { 1095 arCanBuyValues[arCanBuyValues.length] = arShowValues[j]; 1096 } 1097 } 1098 } 1099 else 1100 { 1101 arCanBuyValues = arShowValues; 1102 } 1103 this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues); 1104 } 1105 this.selectedValues = arFilter; 1106 this.ChangeInfo(); 1107}; 1108 1109window.JCCatalogTopSection.prototype.ChangeInfo = function() 1110{ 1111 var i = 0, 1112 j, 1113 index = -1, 1114 boolOneSearch = true; 1115 1116 for (i = 0; i < this.offers.length; i++) 1117 { 1118 boolOneSearch = true; 1119 for (j in this.selectedValues) 1120 { 1121 if (this.selectedValues[j] !== this.offers[i].TREE[j]) 1122 { 1123 boolOneSearch = false; 1124 break; 1125 } 1126 } 1127 if (boolOneSearch) 1128 { 1129 index = i; 1130 break; 1131 } 1132 } 1133 if (-1 < index) 1134 { 1135 if (!!this.obPict) 1136 { 1137 if (!!this.offers[index].PREVIEW_PICTURE) 1138 { 1139 BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}}); 1140 } 1141 else 1142 { 1143 BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}}); 1144 } 1145 } 1146 if (this.secondPict && !!this.obSecondPict) 1147 { 1148 if (!!this.offers[index].PREVIEW_PICTURE_SECOND) 1149 { 1150 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}}); 1151 } 1152 else if (!!this.offers[index].PREVIEW_PICTURE.SRC) 1153 { 1154 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}}); 1155 } 1156 else if (!!this.defaultPict.secondPict) 1157 { 1158 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}}); 1159 } 1160 else 1161 { 1162 BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}}); 1163 } 1164 } 1165 if (this.showSkuProps && !!this.obSkuProps) 1166 { 1167 if (0 === this.offers[index].DISPLAY_PROPERTIES.length) 1168 { 1169 BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''}); 1170 } 1171 else 1172 {
1173 BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES}); 1174 } 1175 } 1176 this.setPrice(this.offers[index].PRICE); 1177 this.offerNum = index; 1178 this.QuantitySet(this.offerNum); 1179 } 1180}; 1181 1182window.JCCatalogTopSection.prototype.setPrice = function(price) 1183{ 1184 var strPrice, 1185 obData; 1186 1187 if (!!this.obPrice) 1188 { 1189 strPrice = BX.Currency.currencyFormat(price.DISCOUNT_VALUE, price.CURRENCY, true); 1190 if (this.showOldPrice && (price.DISCOUNT_VALUE !== price.VALUE)) 1191 { 1192 strPrice += ' <span>'+BX.Currency.currencyFormat(price.VALUE, price.CURRENCY, true)+'</span>'; 1193 } 1194 BX.adjust(this.obPrice, {html: strPrice}); 1195 if (this.showPercent) 1196 { 1197 if (price.DISCOUNT_VALUE !== price.VALUE) 1198 { 1199 obData = { 1200 style: { 1201 display: '' 1202 }, 1203 html: price.DISCOUNT_DIFF_PERCENT 1204 }; 1205 } 1206 else 1207 { 1208 obData = { 1209 style: { 1210 display: 'none' 1211 }, 1212 html: '' 1213 }; 1214 } 1215 if (!!this.obDscPerc) 1216 { 1217 BX.adjust(this.obDscPerc, obData); 1218 } 1219 if (!!this.obSecondDscPerc) 1220 { 1221 BX.adjust(this.obSecondDscPerc, obData); 1222 } 1223 } 1224 } 1225}; 1226 1227window.JCCatalogTopSection.prototype.Compare = function() 1228{ 1229 var compareParams, compareLink; 1230 if (!!this.compareData.compareUrl) 1231 { 1232 switch (this.productType) 1233 { 1234 case 1://product 1235 case 2://set 1236 compareLink = this.compareData.compareUrl.replace('#ID#', this.product.id.toString()); 1237 break; 1238 case 3://sku 1239 compareLink = this.compareData.compareUrl.replace('#ID#', this.offers[this.offerNum].ID); 1240 break; 1241 } 1242 compareParams = { 1243 ajax_action: 'Y' 1244 }; 1245 BX.ajax.loadJSON( 1246 compareLink, 1247 compareParams, 1248 BX.proxy(this.CompareResult, this) 1249 ); 1250 } 1251}; 1252 1253window.JCCatalogTopSection.prototype.CompareResult = function(result) 1254{ 1255 var popupContent, popupButtons, popupTitle; 1256 if (!!this.obPopupWin) 1257 { 1258 this.obPopupWin.close(); 1259 } 1260 if (typeof result !== 'object') 1261 { 1262 return false; 1263 } 1264 this.InitPopupWindow(); 1265 popupTitle = { 1266 content: BX.create('div', { 1267 style: { marginRight: '30px', whiteSpace: 'nowrap' }, 1268 text: BX.message('COMPARE_TITLE') 1269 }) 1270 }; 1271 if (result.STATUS === 'OK') 1272 { 1273 BX.onCustomEvent('OnCompareChange'); 1274 popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+BX.message('COMPARE_MESSAGE_OK')+'</p></div>'; 1275 if (this.showClosePopup) 1276 { 1277 popupButtons = [ 1278 new BasketButton({ 1279 ownerClass: this.obProduct.parentNode.parentNode.className, 1280 text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'), 1281 events: { 1282 click: BX.delegate(this.CompareRedirect, this) 1283 }, 1284 style: {marginRight: '10px'} 1285 }), 1286 new BasketButton({ 1287 ownerClass: this.obProduct.parentNode.parentNode.className, 1288 text: BX.message('BTN_MESSAGE_CLOSE_POPUP'), 1289 events: { 1290 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1291 } 1292 }) 1293 ]; 1294 } 1295 else 1296 { 1297 popupButtons = [ 1298 new BasketButton({ 1299 ownerClass: this.obProduct.parentNode.parentNode.className, 1300 text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'), 1301 events: { 1302 click: BX.delegate(this.CompareRedirect, this) 1303 } 1304 }) 1305 ]; 1306 } 1307 } 1308 else 1309 { 1310 popupContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!result.MESSAGE ? result.MESSAGE : BX.message('COMPARE_UNKNOWN_ERROR'))+'</p></div>'; 1311 popupButtons = [ 1312 new BasketButton({ 1313 ownerClass: this.obProduct.parentNode.parentNode.className, 1314 text: BX.message('BTN_MESSAGE_CLOSE'), 1315 events: { 1316 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1317 } 1318 1319 }) 1320 ]; 1321 } 1322 this.obPopupWin.setTitleBar(popupTitle); 1323 this.obPopupWin.setContent(popupContent); 1324 this.obPopupWin.setButtons(popupButtons); 1325 this.obPopupWin.show(); 1326 return false; 1327}; 1328 1329window.JCCatalogTopSection.prototype.CompareRedirect = function() 1330{ 1331 if (!!this.compareData.comparePath) 1332 { 1333 location.href = this.compareData.comparePath; 1334 } 1335 else 1336 { 1337 this.obPopupWin.close(); 1338 } 1339}; 1340 1341window.JCCatalogTopSection.prototype.InitBasketUrl = function() 1342{ 1343 this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url); 1344 switch (this.productType) 1345 { 1346 case 1://product 1347 case 2://set 1348 this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString()); 1349 break; 1350 case 3://sku 1351 this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID); 1352 break; 1353 } 1354 this.basketParams = { 1355 'ajax_basket': 'Y' 1356 }; 1357 if (this.showQuantity) 1358 { 1359 this.basketParams[this.basketData.quantity] = this.obQuantity.value; 1360 } 1361 if (!!this.basketData.sku_props) 1362 { 1363 this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props; 1364 } 1365}; 1366 1367window.JCCatalogTopSection.prototype.FillBasketProps = function() 1368{ 1369 if (!this.visual.BASKET_PROP_DIV) 1370 { 1371 return; 1372 } 1373 var 1374 i = 0, 1375 propCollection = null, 1376 foundValues = false, 1377 obBasketProps = null; 1378 1379 if (this.basketData.useProps && !this.basketData.emptyProps) 1380 { 1381 if (!!this.obPopupWin && !!this.obPopupWin.contentContainer) 1382 { 1383 obBasketProps = this.obPopupWin.contentContainer; 1384 } 1385 } 1386 else 1387 { 1388 obBasketProps = BX(this.visual.BASKET_PROP_DIV); 1389 } 1390 if (!!obBasketProps) 1391 { 1392 propCollection = obBasketProps.getElementsByTagName('select'); 1393 if (!!propCollection && !!propCollection.length) 1394 { 1395 for (i = 0; i < propCollection.length; i++) 1396 { 1397 if (!propCollection[i].disabled) 1398 { 1399 switch(propCollection[i].type.toLowerCase()) 1400 { 1401 case 'select-one': 1402 this.basketParams[propCollection[i].name] = propCollection[i].value; 1403 foundValues = true; 1404 break; 1405 default: 1406 break; 1407 } 1408 } 1409 } 1410 } 1411 propCollection = obBasketProps.getElementsByTagName('input'); 1412 if (!!propCollection && !!propCollection.length) 1413 { 1414 for (i = 0; i < propCollection.length; i++) 1415 { 1416 if (!propCollection[i].disabled) 1417 { 1418 switch(propCollection[i].type.toLowerCase()) 1419 { 1420 case 'hidden': 1421 this.basketParams[propCollection[i].name] = propCollection[i].value; 1422 foundValues = true; 1423 break; 1424 case 'radio': 1425 if (propCollection[i].checked) 1426 { 1427 this.basketParams[propCollection[i].name] = propCollection[i].value; 1428 foundValues = true; 1429 } 1430 break; 1431 default: 1432 break; 1433 } 1434 } 1435 } 1436 } 1437 } 1438 if (!foundValues) 1439 { 1440 this.basketParams[this.basketData.props] = []; 1441 this.basketParams[this.basketData.props][0] = 0; 1442 } 1443}; 1444 1445window.JCCatalogTopSection.prototype.Add2Basket = function() 1446{ 1447 this.basketMode = 'ADD'; 1448 this.Basket(); 1449}; 1450 1451window.JCCatalogTopSection.prototype.BuyBasket = function() 1452{ 1453 this.basketMode = 'BUY'; 1454 this.Basket(); 1455}; 1456 1457window.JCCatalogTopSection.prototype.SendToBasket = function() 1458{ 1459 if (!this.canBuy) 1460 { 1461 return; 1462 } 1463 this.InitBasketUrl(); 1464 this.FillBasketProps();
1465 BX.ajax.loadJSON( 1466 this.basketUrl, 1467 this.basketParams, 1468 BX.delegate(this.BasketResult, this) 1469 ); 1470}; 1471 1472window.JCCatalogTopSection.prototype.Basket = function() 1473{ 1474 var contentBasketProps = ''; 1475 if (!this.canBuy) 1476 { 1477 return; 1478 } 1479 switch (this.productType) 1480 { 1481 case 1://product 1482 case 2://set 1483 if (this.basketData.useProps && !this.basketData.emptyProps) 1484 { 1485 this.InitPopupWindow(); 1486 this.obPopupWin.setTitleBar({ 1487 content: BX.create('div', { 1488 style: { marginRight: '30px', whiteSpace: 'nowrap' }, 1489 text: BX.message('TITLE_BASKET_PROPS') 1490 }) 1491 }); 1492 if (BX(this.visual.BASKET_PROP_DIV)) 1493 { 1494 contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML; 1495 } 1496 this.obPopupWin.setContent(contentBasketProps); 1497 this.obPopupWin.setButtons([ 1498 new BasketButton({ 1499 ownerClass: this.obProduct.parentNode.parentNode.className, 1500 text: BX.message('BTN_MESSAGE_SEND_PROPS'), 1501 events: { 1502 click: BX.delegate(this.SendToBasket, this) 1503 } 1504 }) 1505 ]); 1506 this.obPopupWin.show(); 1507 } 1508 else 1509 { 1510 this.SendToBasket(); 1511 } 1512 break; 1513 case 3://sku 1514 this.SendToBasket(); 1515 break; 1516 } 1517}; 1518 1519window.JCCatalogTopSection.prototype.BasketResult = function(arResult) 1520{ 1521 var strContent = '', 1522 strPict = '', 1523 successful, 1524 buttons = []; 1525 1526 if (!!this.obPopupWin) 1527 { 1528 this.obPopupWin.close(); 1529 } 1530 if ('object' !== typeof arResult) 1531 { 1532 return false; 1533 } 1534 successful = (arResult.STATUS === 'OK'); 1535 if (successful && this.basketAction === 'BUY') 1536 { 1537 this.BasketRedirect(); 1538 } 1539 else 1540 { 1541 this.InitPopupWindow(); 1542 if (successful) 1543 { 1544 BX.onCustomEvent('OnBasketChange'); 1545 switch(this.productType) 1546 { 1547 case 1:// 1548 case 2:// 1549 strPict = this.product.pict.SRC; 1550 break; 1551 case 3: 1552 strPict = (!!this.offers[this.offerNum].PREVIEW_PICTURE ? 1553 this.offers[this.offerNum].PREVIEW_PICTURE.SRC : 1554 this.defaultPict.pict.SRC 1555 ); 1556 break; 1557 } 1558 strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><img src="'+strPict+'" height="130"><p>'+this.product.name+'</p></div>'; 1559 if (this.showClosePopup) 1560 { 1561 buttons = [ 1562 new BasketButton({ 1563 ownerClass: this.obProduct.parentNode.parentNode.className, 1564 text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"), 1565 events: { 1566 click: BX.delegate(this.BasketRedirect, this) 1567 }, 1568 style: {marginRight: '10px'} 1569 }), 1570 new BasketButton({ 1571 ownerClass: this.obProduct.parentNode.parentNode.className, 1572 text: BX.message("BTN_MESSAGE_CLOSE_POPUP"), 1573 events: { 1574 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1575 } 1576 }) 1577 ]; 1578 } 1579 else 1580 { 1581 buttons = [ 1582 new BasketButton({ 1583 ownerClass: this.obProduct.parentNode.parentNode.className, 1584 text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"), 1585 events: { 1586 click: BX.delegate(this.BasketRedirect, this) 1587 } 1588 }) 1589 ]; 1590 } 1591 } 1592 else 1593 { 1594 strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><p>'+(!!arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'))+'</p></div>'; 1595 buttons = [ 1596 new BasketButton({ 1597 ownerClass: this.obProduct.parentNode.parentNode.className, 1598 text: BX.message('BTN_MESSAGE_CLOSE'), 1599 events: { 1600 click: BX.delegate(this.obPopupWin.close, this.obPopupWin) 1601 } 1602 }) 1603 ]; 1604 } 1605 this.obPopupWin.setTitleBar({ 1606 content: BX.create('div', { 1607 style: { marginRight: '30px', whiteSpace: 'nowrap' }, 1608 text: (successful ? BX.message('TITLE_SUCCESSFUL') : BX.message('TITLE_ERROR')) 1609 }) 1610 }); 1611 this.obPopupWin.setContent(strContent); 1612 this.obPopupWin.setButtons(buttons); 1613 this.obPopupWin.show(); 1614 } 1615}; 1616 1617window.JCCatalogTopSection.prototype.BasketRedirect = function() 1618{ 1619 location.href = (!!this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL')); 1620}; 1621 1622window.JCCatalogTopSection.prototype.InitPopupWindow = function() 1623{ 1624 if (!!this.obPopupWin) 1625 { 1626 return; 1627 } 1628 this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_'+this.visual.ID, null, { 1629 autoHide: false, 1630 offsetLeft: 0, 1631 offsetTop: 0, 1632 overlay : true, 1633 closeByEsc: true, 1634 titleBar: true, 1635 closeIcon: {top: '10px', right: '10px'} 1636 }); 1637}; 1638})(window);
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.