1(function ($, ssCore) { 2 3 $(document).ready(function () { 4 5 var closeMenuSelector = '.close-menu > span.close-menu-btn'; 6 var closeSideMenu = '.close-side-menu-btn'; 7 var flyoutCartScrollbarSelector = '#flyout-cart .flyout-cart-scroll-area'; 8 9 var dependencies = [ 10 { 11 module: "header", 12 dependencies: ["attachDetach", "overlay", "perfectScrollbar"] 13 }, 14 { 15 module: "menu", 16 dependencies: ["perfectScrollbar"] 17 } 18 ]; 19 20 var themeSettings = { 21 overlay: { 22 overlayElementSelector: '.overlayOffCanvas', 23 overlayClass: 'show', 24 noPageScrollClass: 'scrollYRemove' 25 }, 26 productQuantity: { 27 quantityInputSelector: '.qty-input, .productQuantityTextBox', 28 incrementSelectors: '.plus', 29 decrementSelectors: '.minus' 30 }, 31 flyoutCart: { 32 flyoutCartSelector: '#flyout-cart', 33 flyoutCartScrollbarSelector: flyoutCartScrollbarSelector + ' .items', 34 removeItemSelector: '#flyout-cart .remove-item' 35 }, 36 header: { 37 activeClass: 'open', 38 modules: [ 39 { 40 opener: '.header-links .opener', 41 content: '.profile-menu-box', 42 preventClicking: true 43 }, 44 { 45 content: '.flyout-cart', 46 overlay: false, 47 scrollbar: flyoutCartScrollbarSelector + ' .items' 48 } 49 ] 50 }, 51 goToTop: { 52 animation: { 53 type: 'slide', // Fade, slide, none 54 speed: 500 // Animation in speed (ms) 55 } 56 }, 57 toggle: { 58 blocks: [ 59 { 60 opener: '.write-review .title', 61 content: '.write-review-collapse', 62 activeClassOpener: 'open', 63 animation: { 64 type: 'slide', 65 speed: 'slow' 66 } 67 }, 68 { 69 opener: '.comment-form-btn', 70 content: '.new-comment form', 71 activeClassOpener: 'open', 72 animation: { 73 type: 'slide', 74 speed: 'slow' 75 } 76 }, 77 { 78 opener: '.cart-collaterals > div > .title', 79 content: '.cart-collaterals > div > .list', 80 activeClassOpener: 'open', 81 animation: { 82 type: 'slide', 83 speed: 'slow' 84 } 85 }, 86 { 87 opener: '.add-button .btn-holder', 88 content: '.add-button .enter-address', 89 activeClassOpener: 'open', 90 animation: { 91 type: 'slide', 92 speed: 'slow' 93 } 94 } 95 ] 96 }, 97 equalizer: { 98 blocks: [ 99 { 100 selector: '.address-list > div', 101 property: 'height', 102 measurementFunction: 'innerHeight' 103 }, 104 { 105 selector: '.address-grid > div', 106 property: 'min-height', 107 measurementFunction: 'innerHeight' 108 }, 109 { 110 selector: '.order-item', 111 property: 'height',
112 measurementFunction: 'innerHeight' 113 }, 114 { 115 selector: '.request-item', 116 property: 'height', 117 measurementFunction: 'innerHeight' 118 }, 119 { 120 selector: '.news-item', 121 property: 'height', 122 measurementFunction: 'innerHeight' 123 }, 124 { 125 selector: '.blog-posts .post', 126 property: 'height', 127 measurementFunction: 'innerHeight' 128 }, 129 { 130 selector: '.order-details-area > div', 131 property: 'height', 132 measurementFunction: 'innerHeight' 133 }, 134 { 135 selector: '.order-review-data > div', 136 property: 'height', 137 measurementFunction: 'innerHeight' 138 }, 139 { 140 selector: '.shipment-details-area > div', 141 property: 'height', 142 measurementFunction: 'innerHeight' 143 }, 144 { 145 selector: '.rich-blog-homepage .blog-post', 146 property: 'height', 147 measurementFunction: 'innerHeight' 148 } 149 ] 150 }, 151 attachDetach: { 152 blocks: [ 153 { 154 elementToAttach: '.header-selectors-wrapper', 155 content: '.admin-header-links', 156 insertAction: 'prependTo' 157 } 158 ] 159 }, 160 responsive: [ 161 { 162 breakpoint: 1281, 163 settings: { 164 attachDetach: { 165 blocks: [ 166 { 167 elementToAttach: '.header-selectors-wrapper', 168 content: '.admin-header-links', 169 insertAction: 'prependTo' 170 }, 171 { 172 elementToAttach: ".product-details-page-body .mobile-name-holder", 173 content: ".product-details-page-body .breadcrumb" 174 }, 175 { 176 elementToAttach: ".product-details-page-body .mobile-name-holder", 177 content: ".product-details-page-body .product-name" 178 }, 179 { 180 elementToAttach: ".product-details-page-body .attributes-wrapper", 181 content: ".product-details-page-body .product-prices-box" 182 }, 183 { 184 elementToAttach: ".product-details-page .mobile-prev-next-holder", 185 content: ".product-details-page .prev-next-holder" 186 } 187 ] 188 }, 189 header: { 190 activeClass: 'open', 191 modules: [ 192 { 193 opener: '.header-links .opener', 194 content: '.profile-menu-box', 195 preventClicking: true 196 }, 197 { 198 content: '.flyout-cart', 199 overlay: false, 200 scrollbar: flyoutCartScrollbarSelector + ' .items' 201 } 202 ] 203 },
204 equalizer: { 205 blocks: [ 206 { 207 selector: '.address-list > div', 208 property: 'height', 209 measurementFunction: 'innerHeight' 210 }, 211 { 212 selector: '.address-grid > div', 213 property: 'min-height', 214 measurementFunction: 'innerHeight' 215 }, 216 { 217 selector: '.order-item', 218 property: 'height', 219 measurementFunction: 'innerHeight' 220 }, 221 { 222 selector: '.request-item', 223 property: 'height', 224 measurementFunction: 'innerHeight' 225 }, 226 { 227 selector: '.news-item', 228 property: 'height', 229 measurementFunction: 'innerHeight' 230 }, 231 { 232 selector: '.blog-posts .post', 233 property: 'height', 234 measurementFunction: 'innerHeight' 235 }, 236 { 237 selector: '.order-details-area > div', 238 property: 'height', 239 measurementFunction: 'innerHeight' 240 }, 241 { 242 selector: '.order-review-data > div', 243 property: 'height', 244 measurementFunction: 'innerHeight' 245 }, 246 { 247 selector: '.shipment-details-area > div', 248 property: 'height', 249 measurementFunction: 'innerHeight' 250 }, 251 { 252 selector: '.rich-blog-homepage .blog-post', 253 property: 'height', 254 measurementFunction: 'innerHeight' 255 } 256 ] 257 } 258 } 259 }, 260 { 261 breakpoint: 1025, 262 settings: { 263 menu: { 264 closeMenuSelector: closeMenuSelector, 265 sublistIndent: { 266 enabled: true 267 } 268 }, 269 flyoutCart: { 270 flyoutCartSelector: '#flyout-cart', 271 flyoutCartScrollbarSelector: '', 272 removeItemSelector: '#flyout-cart .remove-item' 273 }, 274 attachDetach: { 275 blocks: [ 276 { 277 content: '#topcartlink .ico-cart', 278 elementToAttach: '.responsive-nav-wrapper .shopping-cart-link' 279 }, 280 { 281 content: '.header-selectors-wrapper', 282 elementToAttach: '.mobile-menu-items' 283 }, 284 { 285 content: '.ico-compare', 286 elementToAttach: '.header-menu' 287 }, 288 { 289 content: '.ico-wishlist', 290 elementToAttach: '.header-menu' 291 }, 292 { 293 elementToAttach: ".product-details-page-body .mobile-name-holder", 294 content: ".product-details-page-body .breadcrumb" 295 }, 296 { 297 elementToAttach: ".product-details-page-body .mobile-name-holder", 298 content: ".product-details-page-body .product-name" 299 }, 300 { 301 elementToAttach: ".product-details-page-body .attributes-wrapper", 302 content: ".product-details-page-body .product-prices-box" 303 }, 304 { 305 elementToAttach: ".product-details-page .mobile-prev-next-holder", 306 content: ".product-details-page .prev-next-holder" 307 } 308 ] 309 }, 310 header: {
311 activeClass: 'open', 312 modules: [ 313 { 314 opener: '.search-wrap > span', 315 content: '.store-search-box', 316 closer: '.store-search-box ' + closeSideMenu, 317 elementToAttach: '.master-wrapper-page', 318 disablePageScroll: true, 319 overlay: true 320 }, 321 { 322 opener: '.personal-button > span', 323 closer: '.profile-menu-box ' + closeSideMenu, 324 content: '.profile-menu-box', 325 elementToAttach: '.header', 326 disablePageScroll: true, 327 overlay: true 328 }, 329 { 330 opener: '.shopping-cart-link', 331 closer: '.mobile-flyout-wrapper ' + closeSideMenu, 332 content: '.mobile-flyout-wrapper', 333 preventClicking: true, 334 disablePageScroll: true, 335 overlay: true, 336 scrollbar: '' 337 }, 338 { 339 opener: '.responsive-nav-wrapper .menu-title > span', 340 closer: closeMenuSelector, 341 content: '.header-menu', 342 disablePageScroll: true, 343 overlay: true, 344 scrollbar: true 345 }, 346 { 347 elementToAttach: '.master-wrapper-content', 348 opener: '.filters-button-wrapper .filters-button', 349 closer: '.nopAjaxFilters7Spikes ' + closeSideMenu, 350 content: '.nopAjaxFilters7Spikes', 351 disablePageScroll: true, 352 overlay: true 353 } 354 ] 355 }, 356 filters: true, 357 toggle: { 358 blocks: [ 359 { 360 opener: '.block > .title', 361 content: '.block > .listbox', 362 animation: { 363 type: 'slide' 364 } 365 }, 366 { 367 opener: '.mobile-selector .selector-title', 368 content: '.mobile-collapse', 369 activeClassOpener: 'open', 370 animation: { 371 type: 'slide', 372 speed: 'slow' 373 } 374 }, 375 { 376 opener: '.write-review .title', 377 content: '.write-review-collapse', 378 activeClassOpener: 'open', 379 animation: { 380 type: 'slide', 381 speed: 'slow' 382 } 383 }, 384 { 385 opener: '.comment-form-btn', 386 content: '.new-comment form', 387 activeClassOpener: 'open', 388 animation: { 389 type: 'slide', 390 speed: 'slow' 391 } 392 }, 393 { 394 opener: '.cart-collaterals > div > .title', 395 content: '.cart-collaterals > div > .list', 396 activeClassOpener: 'open', 397 animation: { 398 type: 'slide', 399 speed: 'slow' 400 } 401 }, 402 { 403 opener: '.add-button .btn-holder', 404 content: '.add-button .enter-address', 405 activeClassOpener: 'open', 406 animation: { 407 type: 'slide', 408 speed: 'slow' 409 } 410 } 411 ] 412 },
413 equalizer: { 414 blocks: [ 415 { 416 selector: '.cart tr .product' 417 }, 418 { 419 selector: '.data-table .product' 420 }, 421 { 422 selector: '.address-list > div', 423 property: 'height', 424 measurementFunction: 'innerHeight' 425 }, 426 { 427 selector: '.address-grid > div', 428 property: 'min-height', 429 measurementFunction: 'innerHeight' 430 }, 431 { 432 selector: '.order-item', 433 property: 'height', 434 measurementFunction: 'innerHeight' 435 }, 436 { 437 selector: '.request-item', 438 property: 'height', 439 measurementFunction: 'innerHeight' 440 }, 441 { 442 selector: '.news-item', 443 property: 'height', 444 measurementFunction: 'innerHeight' 445 }, 446 { 447 selector: '.blog-posts .post', 448 property: 'height', 449 measurementFunction: 'innerHeight' 450 }, 451 { 452 selector: '.order-details-area > div', 453 property: 'height', 454 measurementFunction: 'innerHeight' 455 }, 456 { 457 selector: '.order-review-data > div', 458 property: 'height', 459 measurementFunction: 'innerHeight' 460 }, 461 { 462 selector: '.shipment-details-area > div', 463 property: 'height', 464 measurementFunction: 'innerHeight' 465 }, 466 { 467 selector: '.rich-blog-homepage .blog-post', 468 property: 'height', 469 measurementFunction: 'innerHeight' 470 } 471 ] 472 } 473 } 474 }, 475 { 476 breakpoint: 769, 477 settings: { 478 menu: { 479 closeMenuSelector: closeMenuSelector, 480 sublistIndent: { 481 enabled: true 482 } 483 }, 484 flyoutCart: { 485 flyoutCartSelector: '#flyout-cart', 486 flyoutCartScrollbarSelector: '', 487 removeItemSelector: '#flyout-cart .remove-item' 488 }, 489 attachDetach: { 490 blocks: [ 491 { 492 content: '#topcartlink .ico-cart', 493 elementToAttach: '.responsive-nav-wrapper .shopping-cart-link' 494 }, 495 { 496 content: '.header-selectors-wrapper', 497 elementToAttach: '.mobile-menu-items' 498 }, 499 { 500 content: '.ico-compare', 501 elementToAttach: '.header-menu' 502 }, 503 { 504 content: '.ico-wishlist', 505 elementToAttach: '.header-menu' 506 }, 507 { 508 elementToAttach: ".product-details-page-body .mobile-name-holder", 509 content: ".product-details-page-body .breadcrumb" 510 }, 511 { 512 elementToAttach: ".product-details-page-body .mobile-name-holder", 513 content: ".product-details-page-body .product-name" 514 }, 515 { 516 elementToAttach: ".product-details-page-body .attributes-wrapper", 517 content: ".product-details-page-body .product-prices-box" 518 }, 519 { 520 elementToAttach: ".product-details-page .mobile-prev-next-holder", 521 content: ".product-details-page .prev-next-holder" 522 } 523 ] 524 }, 525 header: {
526 activeClass: 'open', 527 modules: [ 528 { 529 opener: '.search-wrap > span', 530 content: '.store-search-box', 531 closer: '.store-search-box ' + closeSideMenu, 532 elementToAttach: '.master-wrapper-page', 533 disablePageScroll: true, 534 overlay: true 535 }, 536 { 537 opener: '.personal-button > span', 538 closer: '.profile-menu-box ' + closeSideMenu, 539 content: '.profile-menu-box', 540 elementToAttach: '.header', 541 disablePageScroll: true, 542 overlay: true 543 }, 544 { 545 opener: '.shopping-cart-link', 546 closer: '.mobile-flyout-wrapper ' + closeSideMenu, 547 content: '.mobile-flyout-wrapper', 548 preventClicking: true, 549 disablePageScroll: true, 550 overlay: true, 551 scrollbar: '' 552 }, 553 { 554 opener: '.responsive-nav-wrapper .menu-title > span', 555 closer: closeMenuSelector, 556 content: '.header-menu', 557 disablePageScroll: true, 558 overlay: true, 559 scrollbar: true 560 }, 561 { 562 elementToAttach: '.master-wrapper-content', 563 opener: '.filters-button-wrapper .filters-button', 564 closer: '.nopAjaxFilters7Spikes ' + closeSideMenu, 565 content: '.nopAjaxFilters7Spikes', 566 disablePageScroll: true, 567 overlay: true 568 } 569 ] 570 }, 571 filters: true, 572 toggle: { 573 blocks: [ 574 { 575 opener: '.block > .title', 576 content: '.block > .listbox', 577 animation: { 578 type: 'slide' 579 } 580 }, 581 { 582 opener: '.mobile-selector .selector-title', 583 content: '.mobile-collapse', 584 activeClassOpener: 'open', 585 animation: { 586 type: 'slide', 587 speed: 'slow' 588 } 589 }, 590 { 591 opener: '.write-review .title', 592 content: '.write-review-collapse', 593 activeClassOpener: 'open', 594 animation: { 595 type: 'slide', 596 speed: 'slow' 597 } 598 }, 599 { 600 opener: '.comment-form-btn', 601 content: '.new-comment form', 602 activeClassOpener: 'open', 603 animation: { 604 type: 'slide', 605 speed: 'slow' 606 } 607 }, 608 { 609 opener: '.cart-collaterals > div > .title', 610 content: '.cart-collaterals > div > .list', 611 activeClassOpener: 'open', 612 animation: { 613 type: 'slide', 614 speed: 'slow' 615 } 616 }, 617 { 618 opener: '.add-button .btn-holder', 619 content: '.add-button .enter-address', 620 activeClassOpener: 'open', 621 animation: { 622 type: 'slide', 623 speed: 'slow' 624 } 625 } 626 ] 627 },
628 equalizer: { 629 blocks: [ 630 { 631 selector: '.cart tr .product' 632 }, 633 { 634 selector: '.data-table .product' 635 }, 636 { 637 selector: '.address-list > div', 638 property: 'height', 639 measurementFunction: 'innerHeight' 640 }, 641 { 642 selector: '.address-grid > div', 643 property: 'min-height', 644 measurementFunction: 'innerHeight' 645 }, 646 { 647 selector: '.order-item', 648 property: 'height', 649 measurementFunction: 'innerHeight' 650 }, 651 { 652 selector: '.request-item', 653 property: 'height', 654 measurementFunction: 'innerHeight' 655 }, 656 { 657 selector: '.news-item', 658 property: 'height', 659 measurementFunction: 'innerHeight' 660 }, 661 { 662 selector: '.blog-posts .post', 663 property: 'height', 664 measurementFunction: 'innerHeight' 665 }, 666 { 667 selector: '.order-details-area > div', 668 property: 'height', 669 measurementFunction: 'innerHeight' 670 }, 671 { 672 selector: '.order-review-data > div', 673 property: 'height', 674 measurementFunction: 'innerHeight' 675 }, 676 { 677 selector: '.shipment-details-area > div', 678 property: 'height', 679 measurementFunction: 'innerHeight' 680 }, 681 { 682 selector: '.rich-blog-homepage .blog-post', 683 property: 'height', 684 measurementFunction: 'innerHeight' 685 } 686 ] 687 } 688 } 689 }, 690 { 691 breakpoint: 481, 692 settings: { 693 menu: { 694 closeMenuSelector: closeMenuSelector, 695 sublistIndent: { 696 enabled: true 697 } 698 }, 699 flyoutCart: { 700 flyoutCartSelector: '#flyout-cart', 701 flyoutCartScrollbarSelector: '', 702 removeItemSelector: '#flyout-cart .remove-item' 703 }, 704 attachDetach: { 705 blocks: [ 706 { 707 content: '#topcartlink .ico-cart', 708 elementToAttach: '.responsive-nav-wrapper .shopping-cart-link' 709 }, 710 { 711 content: '.header-selectors-wrapper', 712 elementToAttach: '.mobile-menu-items' 713 }, 714 { 715 content: '.ico-compare', 716 elementToAttach: '.header-menu' 717 }, 718 { 719 content: '.ico-wishlist', 720 elementToAttach: '.header-menu' 721 }, 722 { 723 elementToAttach: ".product-details-page-body .mobile-name-holder", 724 content: ".product-details-page-body .breadcrumb" 725 }, 726 { 727 elementToAttach: ".product-details-page-body .mobile-name-holder", 728 content: ".product-details-page-body .product-name" 729 }, 730 { 731 elementToAttach: ".product-details-page-body .attributes-wrapper", 732 content: ".product-details-page-body .product-prices-box" 733 }, 734 { 735 elementToAttach: ".product-details-page .mobile-prev-next-holder", 736 content: ".product-details-page .prev-next-holder" 737 } 738 ] 739 }, 740 header: {
741 activeClass: 'open', 742 modules: [ 743 { 744 opener: '.search-wrap > span', 745 content: '.store-search-box', 746 closer: '.store-search-box ' + closeSideMenu, 747 elementToAttach: '.master-wrapper-page', 748 disablePageScroll: true, 749 overlay: true 750 }, 751 { 752 opener: '.personal-button > span', 753 closer: '.profile-menu-box ' + closeSideMenu, 754 content: '.profile-menu-box', 755 elementToAttach: '.header', 756 disablePageScroll: true, 757 overlay: true 758 }, 759 { 760 opener: '.shopping-cart-link', 761 closer: '.mobile-flyout-wrapper ' + closeSideMenu, 762 content: '.mobile-flyout-wrapper', 763 preventClicking: true, 764 disablePageScroll: true, 765 overlay: true, 766 scrollbar: '' 767 }, 768 { 769 opener: '.responsive-nav-wrapper .menu-title > span', 770 closer: closeMenuSelector, 771 content: '.header-menu', 772 disablePageScroll: true, 773 overlay: true, 774 scrollbar: true 775 }, 776 { 777 elementToAttach: '.master-wrapper-content', 778 opener: '.filters-button-wrapper .filters-button', 779 closer: '.nopAjaxFilters7Spikes ' + closeSideMenu, 780 content: '.nopAjaxFilters7Spikes', 781 disablePageScroll: true, 782 overlay: true 783 } 784 ] 785 }, 786 filters: true, 787 toggle: { 788 blocks: [ 789 { 790 opener: '.block > .title', 791 content: '.block > .listbox', 792 animation: { 793 type: 'slide' 794 } 795 }, 796 { 797 opener: '.mobile-selector .selector-title', 798 content: '.mobile-collapse', 799 activeClassOpener: 'open', 800 animation: { 801 type: 'slide', 802 speed: 'slow' 803 } 804 }, 805 { 806 opener: '.footer-block > .title', 807 content: '.footer-block > .list', 808 animation: { 809 type: 'slide' 810 } 811 }, 812 { 813 opener: '.write-review .title', 814 content: '.write-review-collapse', 815 activeClassOpener: 'open', 816 animation: { 817 type: 'slide', 818 speed: 'slow' 819 } 820 }, 821 { 822 opener: '.comment-form-btn', 823 content: '.new-comment form', 824 activeClassOpener: 'open', 825 animation: { 826 type: 'slide', 827 speed: 'slow' 828 } 829 }, 830 { 831 opener: '.cart-collaterals > div > .title', 832 content: '.cart-collaterals > div > .list', 833 activeClassOpener: 'open', 834 animation: { 835 type: 'slide', 836 speed: 'slow' 837 } 838 }, 839 { 840 opener: '.add-button .btn-holder', 841 content: '.add-button .enter-address', 842 activeClassOpener: 'open', 843 animation: { 844 type: 'slide', 845 speed: 'slow' 846 } 847 } 848 ] 849 },
850 equalizer: { 851 blocks: [ 852 { 853 selector: '.cart tr .product' 854 }, 855 { 856 selector: '.data-table .product' 857 } 858 ] 859 } 860 } 861 } 862 863 ] 864 }; 865 866 var theme = new window.sevenSpikesTheme(themeSettings, dependencies, false); 867 868 theme.init(); 869 870 groupedButton(); 871 handleHeaderMenuCategories(); 872 menuEqualizer(); 873 accountPageColumns(); 874 handleClearCartButton(); 875 updateCartMobiile(); 876 handleLastActiveCheckoutStep(); 877 handleHomePageFeaturedProductsCarousel(); 878 handleHomePageBestsellerProductsCarousel(); 879 setMaxHeightOnMobile('.header-menu'); 880 setMaxHeightOnMobile('.mobile-flyout-wrapper .flyout-cart-scroll-area', '.close-side-menu'); 881 setMaxHeightOnMobile('.nopAjaxFilters7Spikes .filtersPanel', '.close-side-menu'); 882 setMaxHeightOnMobile('.header-menu .sublist-wrap'); 883 handleExpand(".cart-collaterals .deals .message-failure", ".cart-collaterals .deals > .list", ".cart-collaterals > .deals > .title"); 884 handleExpand(".cart-collaterals .collaterals-shipping .message-failure", ".cart-collaterals .collaterals-shipping > .list", ".cart-collaterals .collaterals-shipping > .title"); 885 handleExpand(".write-review .message-error, .write-review .field-validation-error", ".write-review-collapse", ".write-review > .title"); 886 handleExpand(".new-comment .message-error, .new-comment .field-validation-error", ".new-comment form", ".comment-form-btn"); 887 handleExpand(".address-grid .field-validation-error", ".enter-address", ".address-grid .add-button"); 888 889 if ($('.profile-menu-box').hasClass('login-form-in-header')) { 890 891 showLoginFormInHeaderPanel(); 892 } 893 894 $(window).on('resize', function () { 895 setMaxHeightOnMobile('.header-menu'); 896 setMaxHeightOnMobile('.mobile-flyout-wrapper .flyout-cart-scroll-area', '.close-side-menu'); 897 setMaxHeightOnMobile('.nopAjaxFilters7Spikes .filtersPanel', '.close-side-menu'); 898 setMaxHeightOnMobile('.header-menu .sublist-wrap'); 899 menuEqualizer(); 900 accountPageColumns(); 901 }); 902 903 $(document).on('initializePerfectScrollbar.theme', function () { 904 905 setMaxHeightOnMobile('.mobile-flyout-wrapper .flyout-cart-scroll-area', '.close-side-menu'); 906 }); 907 908 $(document).on("quickTabsRefreshedTab quickTabsLoadedTab", function () { 909 910 handleExpand(".write-review .message-error, .write-review .field-validation-error", ".write-review-collapse", ".write-review > .title"); 911 }); 912 913 function groupedButton() { 914 915 if (!$('.product-variant-line').length) { 916 917 return; 918 } 919 920 //Sets the number of product varinats in the button 921 $(".grouped-btn > span").text($('.product-variant-line').length); 922 923 //Click on the button scrolls to the first variant 924 $(".grouped-btn").on('click', function(event) { 925 926 event.preventDefault(); 927 928 $('html, body').animate({ 929 scrollTop: $('#product-list-start').offset().top 930 }, 1000); 931 }); 932 } 933 934 function handleHeaderMenuCategories() { 935 if ($('.header-menu.categories-in-side-panel').length === 0) { 936 return; 937 } 938 939 var sideCategoriesList = $('.category-navigation-list-wrapper > .category-navigation-list'); 940 941 var topMenuCategoryItems = $('.main-menu li.root-category-items, ' + 942 '.mega-menu > li.root-category-items, ' + 943 '.mega-menu > li.category-menu-item > .sublist-wrap > .sublist > li.root-category-items'); 944 945 var topMenuCategoryItemsCloned = topMenuCategoryItems.clone(true, true); 946 947 // Remove root-category-items class and hidden styles/classes from cloned items 948 topMenuCategoryItemsCloned.removeClass('root-category-items hidden-category-for-js'); 949 topMenuCategoryItemsCloned.find('*').removeClass('hidden-category-for-js'); 950 951 // Function to clean display:none from all nested elements recursively 952 function cleanDisplayNone($element) { 953 $element.find('*').addBack().each(function() { 954 var $this = $(this); 955 var style = $this.attr('style') || ''; 956 if (style && (style.indexOf('display') !== -1 || style.indexOf('Display') !== -1)) { 957 // Remove display:none (with or without !important) from style attribute 958 style = style.replace(/display\s*:\s*none\s*!?\s*important?;?/gi, '').trim(); 959 // Clean up any trailing semicolons or empty style attributes 960 style = style.replace(/^;+|;+$/g, '').trim(); 961 if (style && style !== ';') { 962 $this.attr('style', style); 963 } else { 964 $this.removeAttr('style'); 965 } 966 } 967 }); 968 } 969 970 // Clean all nested elements including deeply nested sublist-wrap structures 971 cleanDisplayNone(topMenuCategoryItemsCloned); 972 973 // Recursively ensure all sublist-wrap elements at any nesting level are properly visible 974 function cleanSublistWrap($element) { 975 $element.find('.sublist-wrap').each(function() { 976 var $sublistWrap = $(this); 977 var style = $sublistWrap.attr('style') || ''; 978 // Remove any display:none but preserve other styles (like position, width, etc.) 979 if (style.indexOf('display') !== -1) { 980 style = style.replace(/display\s*:\s*none\s*!?\s*important?;?/gi, '').trim(); 981 style = style.replace(/^;+|;+$/g, '').trim(); 982 if (style && style !== ';') { 983 $sublistWrap.attr('style', style); 984 } else { 985 $sublistWrap.removeAttr('style'); 986 } 987 } 988 // Ensure all children of sublist-wrap are visible (including nested sublist-wrap) 989 $sublistWrap.find('.sublist, .sublist li, li, .sublist-wrap').each(function() { 990 var $child = $(this); 991 var childStyle = $child.attr('style') || ''; 992 if (childStyle.indexOf('display') !== -1) { 993 childStyle = childStyle.replace(/display\s*:\s*none\s*!?\s*important?;?/gi, '').trim(); 994 childStyle = childStyle.replace(/^;+|;+$/g, '').trim(); 995 if (childStyle && childStyle !== ';') { 996 $child.attr('style', childStyle); 997 } else { 998 $child.removeAttr('style'); 999 } 1000 } 1001 }); 1002 // Recursively clean nested sublist-wrap elements 1003 cleanSublistWrap($sublistWrap); 1004 }); 1005 } 1006 1007 // Clean all sublist-wrap elements recursively 1008 cleanSublistWrap(topMenuCategoryItemsCloned); 1009 1010 topMenuCategoryItemsCloned.appendTo(sideCategoriesList); 1011 } 1012 1013 function menuEqualizer() { 1014 1015 if ($(window).width() > 1024) { 1016 1017 sublistHeight(); 1018 } 1019 1020 //Sets a minimum height to each sublist according to the height of its parent 1021 function sublistHeight() { 1022 1023 // to prevent read/write layout changes we need two loops 1024 // only calculate the minHeight in this loop but keep it as data attribute to prevent "write" which forces layout changes 1025 $('.category-navigation-list .sublist, .category-navigation-list .dropdown .row-wrapper').each(function () { 1026 var $this = $(this); 1027 1028 var parentMinHeight = $this.parents('ul').data("minHeight"); 1029 if (parentMinHeight == undefined) { 1030 // if not set then use its height 1031 parentMinHeight = $this.parents('ul').outerHeight(); 1032 } 1033 1034 var minHeight = $this.outerHeight(); 1035 if (minHeight < parentMinHeight) { 1036 minHeight = parentMinHeight; 1037 } 1038 1039 $this.data("minHeight", minHeight); 1040 }); 1041 1042 // now just update the elements based on the already calculated minHeight 1043 $('.category-navigation-list .sublist, .category-navigation-list .dropdown .row-wrapper').each(function () { 1044 var $this = $(this); 1045 1046 var minHeight = $this.data("minHeight"); 1047 1048 if (minHeight) { 1049 $this.css('min-height', minHeight); 1050 } 1051 }); 1052 } 1053 } 1054 1055 function accountPageColumns() { 1056 var navHeight = $('.block-account-navigation').outerHeight(); 1057
1058 $('.account-page').css('min-height', navHeight); 1059 } 1060 1061 function handleClearCartButton() { 1062 1063 $('.order-summary-content .clear-cart-button').on('click', function (e) { 1064 e.preventDefault(); 1065 1066 $('.cart [name="removefromcart"]').attr('checked', 'checked'); 1067 1068 $('.order-summary-content .update-cart-button').click(); 1069 }); 1070 } 1071 1072 function updateCartMobiile() { 1073 1074 $(document).on('removeItemFlyoutCart', function() { 1075 1076 var windowWidth = $(window).width(); 1077 1078 if ($('.shopping-cart-link .ico-cart').length && windowWidth < 1025) { 1079 1080 $('.shopping-cart-link .ico-cart').remove(); 1081 1082 $(document).trigger('detachElement.theme', ['#topcartlink .ico-cart', '.responsive-nav-wrapper .shopping-cart-link']); 1083 } 1084 }); 1085 } 1086 1087 function handleLastActiveCheckoutStep() { 1088 1089 // add a class to the last active checkout step. 1090 $('.active-step:last').addClass('last'); 1091 } 1092 1093 1094 function handleExpand(errors, form, opener) { 1095 1096 if ($(errors).length > 0) { 1097 $(form).slideDown('slow', function () { 1098 1099 /*$('html, body').animate({ 1100 scrollTop: $(opener).offset().top 1101 }, 300);*/ 1102 1103 // this is no longer safe on Product Details pages, because reviews can have error messages by default, not on form submit 1104 // in that case the page will scroll down for no reason. same problem may be present on other pages too 1105 }); 1106 1107 $(opener).addClass("open"); 1108 } 1109 } 1110 1111 function showLoginFormInHeaderPanel() { 1112 1113 var loginUrl = $('.header-links .ico-account').attr('data-loginUrl'); 1114 1115 $.ajax({ 1116 url: loginUrl, 1117 type: 'GET', 1118 data: { 1119 'isHeaderPanel': true 1120 } 1121 }).done(function (data) { 1122 var dataObj = $(data); 1123 var loginFields = dataObj.find('.returning-wrapper'); 1124 1125 if (loginFields.length > 0) { 1126 1127 $('.profile-menu-box .header-form-holder').html(loginFields); 1128 } 1129 1130 }).fail(function () { 1131 window.location.href = loginUrl; 1132 }); 1133 } 1134 1135 function handleHomePageFeaturedProductsCarousel() { 1136 var featuredProductsCarousel = $('.two-row-carousels.small-products .product-grid.home-page-product-grid .item-grid'); 1137 1138 if (featuredProductsCarousel.length === 0) { 1139 return; 1140 } 1141 1142 var featuredProductsLoaded = false 1143 1144 var lazyLoadFeaturedProductsCarousel = function () { 1145 1146 if (ssCore.isInViewPort(featuredProductsCarousel) && !featuredProductsLoaded) { 1147 1148 initializeSlickCarousel(featuredProductsCarousel); 1149 1150 $(window).off('scroll.SevenSpikesEmporiumFeaturedProducts'); 1151 $(window).off('resize.SevenSpikesEmporiumFeaturedProducts'); 1152 1153 featuredProductsLoaded = true; 1154 } 1155 } 1156 1157 lazyLoadFeaturedProductsCarousel(); 1158 $(window).on('scroll.SevenSpikesEmporiumFeaturedProducts', lazyLoadFeaturedProductsCarousel); 1159 $(window).on('resize.SevenSpikesEmporiumFeaturedProducts', lazyLoadFeaturedProductsCarousel); 1160 } 1161 1162 function handleHomePageBestsellerProductsCarousel() { 1163 var bestsellerProductsCarousel = $('.two-row-carousels.small-products .product-grid.bestsellers .item-grid'); 1164 1165 if (bestsellerProductsCarousel.length === 0) { 1166 return; 1167 } 1168 1169 var bestSellersLoaded = false; 1170 1171 var lazyLoadBestsellerProductsCarousel = function () { 1172 1173 if (ssCore.isInViewPort(bestsellerProductsCarousel) && !bestSellersLoaded) { 1174 1175 initializeSlickCarousel(bestsellerProductsCarousel); 1176 1177 $(window).off('scroll.SevenSpikesEmporiumBestSellers'); 1178 $(window).off('resize.SevenSpikesEmporiumBestSellers'); 1179 1180 bestSellersLoaded = true; 1181 } 1182 } 1183 1184 lazyLoadBestsellerProductsCarousel(); 1185 $(window).on('scroll.SevenSpikesEmporiumBestSellers', lazyLoadBestsellerProductsCarousel); 1186 $(window).on('resize.SevenSpikesEmporiumBestSellers', lazyLoadBestsellerProductsCarousel); 1187 } 1188 1189 function initializeSlickCarousel(productsContainter) { 1190 productsContainter.on('init', function () { 1191 $.event.trigger({ type: "newProductsAddedToPageEvent" }); 1192 }); 1193 1194 var isRtl = $("html").attr("dir") == "rtl"; 1195 1196 productsContainter.slick({ 1197 rtl: isRtl, 1198 infinite: true, 1199 rows: 2, 1200 slidesToShow: 4, 1201 slidesToScroll: 1, 1202 arrows: true, 1203 respondTo: 'slider', 1204 easing: "swing", 1205 draggable: false, 1206 pauseOnHover: true, 1207 responsive: getHomePageCarouselResponsiveSettings() 1208 }); 1209 } 1210 1211 function getHomePageCarouselResponsiveSettings() { 1212 var responsiveBreakpointsObj = {}; 1213 1214 if ($('#home-page-carousel-breakpoints').length == 0|| !$('#home-page-carousel-breakpoints').val()) { 1215 return responsiveBreakpointsObj; 1216 } 1217 1218 try { 1219 responsiveBreakpointsObj = JSON.parse($('#home-page-carousel-breakpoints').val()); 1220 } 1221 catch (e) { 1222 console.log('Invalid home page slider responsive breakpoints setting value! (EmporiumThemeSettings.ResponsiveBreakpointsForHomePageProducts)'); 1223 } 1224 1225 return responsiveBreakpointsObj; 1226 } 1227 1228 //This function is written in a way that allows it to be used in other themes if needed 1229 function setMaxHeightOnMobile(element, additionalHeight) { 1230 1231 if (typeof additionalHeight === 'string') { 1232 1233 additionalHeight = $(additionalHeight).outerHeight(); 1234 1235 } else if (typeof additionalHeight === 'undefined') { 1236 1237 additionalHeight = 0; 1238 1239 } 1240 1241 if ($(window).width() <= 1024) { 1242 var storeThemeHeight = $('.header-storetheme').length ? $('.header-storetheme').outerHeight() : 0; 1243 1244 $(element).css('max-height', $(window).height() - additionalHeight - storeThemeHeight); 1245 } 1246 else { 1247 $(element).removeAttr('style'); 1248 } 1249 } 1250 1251 // Additional OPC "edit address" buttons. Use event to apply script to OPC (html markup is not loaded until step load). 1252 1253 if (window.Checkout) { // check if OPC is present 1254 1255 var setStepResponse = Checkout.setStepResponse; 1256 Checkout.setStepResponse = function (response) { 1257 setStepResponse(response); 1258 $(document).trigger("opcStepLoad"); 1259 }; 1260 1261 $('#edit-billing-address-button').removeClass('button-1').addClass('button-2 edit-address-button'); 1262 1263 $(document).on("opcStepLoad", function () { 1264 $('#edit-shipping-address-button').removeClass('button-1').addClass('button-2 edit-address-button'); 1265 }); 1266 } 1267 }); 1268})(jQuery, window.sevenSpikesCore = window.sevenSpikesCore || {});
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.