PageSourceSearch

https://www.discountschoolsupply.com/_ui/responsive/common/js/acc.productDetail.js?v=S540

js discountschoolsupply.com collected 2026-10-03 21:02:17 UTC 33,784 bytes, 885 lines download raw bytes

1ACC.productDetail = {
2
3    _autoload: [
4        "initPageEvents",
5        "bindVariantOptions",
6        "bindSeeMore",
7        "bindCollapse",
8        "bindCreateFavList",
9        "bindAddToExistingFavList"
10    ],
11
12
13    checkQtySelector: function (self, mode) {
14    	var $qtySelector = $(document).find(self).parents(".js-qty-selector");
15        var input = $qtySelector.find(".js-qty-selector-input");
16        var inputVal = parseInt(input.val());
17        var max = input.data("max");
18        var min = input.data("min");
19        var minusBtn = $qtySelector.find(".js-qty-selector-minus");
20        var minusFlyCart = $qtySelector.find(".js-flyout-qty-selector-minus");
21        var plusFlyCart = $qtySelector.find(".js-flyout-qty-selector-plus");
22        var plusBtn = $qtySelector.find(".js-qty-selector-plus");
23        var pdpMinusBtn = $qtySelector.find(".qty-minus-pdp");
24        var pdpInput = $qtySelector.find(".pdp-qty-input");
25        var pdpInputVal = parseInt(pdpInput.val());
26        var pdpMinusBtn = $qtySelector.find(".qty-minus-pdp");
27        $qtySelector.find(".btn").removeAttr("disabled");
28        var isDisabled = pdpMinusBtn.is(":disabled");
29        if (mode == "minus") {
30            if(inputVal == 1){
31                pdpMinusBtn.attr("disabled", "disabled");
32                isDisabled = pdpMinusBtn.is(":disabled");
33            }
34            if(!isDisabled){
35                ACC.productDetail.updateQtyValue(self, inputVal - 1)
36                if (inputVal - 1 < 1 || pdpInputVal - 1 == 1) {
37                    minusBtn.attr("disabled", "disabled")
38                    minusFlyCart.attr("disabled", "disabled")
39                }
40            }
41        } else if (mode == "reset") {
42            ACC.productDetail.updateQtyValue(self, 1)
43
44        } else if (mode == "plus") {
45        	if(max == "FORCE_IN_STOCK") {
46        		ACC.productDetail.updateQtyValue(self, inputVal + 1)
47        	} else if (inputVal <= max) {
48                ACC.productDetail.updateQtyValue(self, inputVal + 1)
49                if (inputVal + 1 == max) {
50                    plusBtn.attr("disabled", "disabled")
51                    plusFlyCart.attr("disabled", "disabled")
52                }
53            } else {
54                plusBtn.attr("disabled", "disabled")
55                plusFlyCart.attr("disabled", "disabled")
56            }
57        } else if (mode == "input") {
58            if (inputVal == 1 || inputVal == 0) {
59                minusBtn.attr("disabled", "disabled")
60            } else if(max == "FORCE_IN_STOCK" && inputVal > 0) {
61            	ACC.productDetail.updateQtyValue(self, inputVal)
62            } else if (inputVal == max) {
63                plusBtn.attr("disabled", "disabled")
64            } else if (inputVal < 1) {
65                ACC.productDetail.updateQtyValue(self, isNaN(pdpInputVal) ? 0:1)
66                minusBtn.attr("disabled", "disabled")
67            } else if (inputVal > max) {
68                ACC.productDetail.updateQtyValue(self, max)
69                plusBtn.attr("disabled", "disabled")
70            }
71        } else if (mode == "focusout") {
72        	if (isNaN(inputVal)){
73                ACC.productDetail.updateQtyValue(self, 1);
74                minusBtn.attr("disabled", "disabled");
75        	} else if(inputVal >= max) {
76                plusBtn.attr("disabled", "disabled");
77            }else if(inputVal <= min) {
78                 minusBtn.attr("disabled", "disabled");
79             }
80
81
82        }
83
84    },
85
86    updateQtyValue: function (self, value) {
87        var input = $(document).find(self).parents(".js-qty-selector").find(".js-qty-selector-input");
88        var addtocartQty = $(".AddToCart-AddToCartAction .js-qty-selector-input");
89        input.val(value);
90        if(value != 0){
91            addtocartQty.val(value);
92        }
93    },
94
95    initPageEvents: function () {
96
97        $(document).on("click", '.js-qty-selector .js-qty-selector-minus', function () {
98            ACC.productDetail.checkQtySelector(this, "minus");
99        })
100
101        $(document).on("click", '.js-qty-selector .js-qty-selector-plus', function () {
102            ACC.productDetail.checkQtySelector(this, "plus");
103        })
104
105        $(document).on("keydown", '.js-qty-selector .js-qty-selector-input', function (e) {
106            if (($(this).val() != " " && ((e.which >= 48 && e.which <= 57 ) || (e.which >= 96 && e.which <= 105 ))  ) || e.which == 8 || e.which == 46 || e.which == 37 || e.
106which == 39 || e.which == 9) {
107            }
108            else if (e.which == 38) {
109                ACC.productDetail.checkQtySelector(this, "plus");
110            }
111            else if (e.which == 40) {
112                ACC.productDetail.checkQtySelector(this, "minus");
113            }
114            else {
115                e.preventDefault();
116            }
117        })
118
119        $(document).on("keyup", '.js-qty-selector .js-qty-selector-input', function (e) {
120
121            ACC.productDetail.checkQtySelector(this, "input");
122            ACC.productDetail.updateQtyValue(this, $(this).val());
123        })
124
125        $(document).on("focusout", '.js-qty-selector .js-qty-selector-input', function (e) {
126            ACC.productDetail.checkQtySelector(this, "focusout");
127            ACC.productDetail.updateQtyValue(this, $(this).val());
128        })
129
130        $("#Size").change(function () {
131            changeOnVariantOptionSelection($("#Size option:selected"));
132        });
133
134        $("#variant").change(function () {
135            changeOnVariantOptionSelection($("#variant option:selected"));
136        });
137
138        $(".selectPriority").change(function () {
139            window.location.href = $(this[this.selectedIndex]).val();
140        });
141
142        function changeOnVariantOptionSelection(optionSelected) {
143            window.location.href = optionSelected.attr('value');
144        }
145
146        ACC.productDetail.bindCarousels();
147        ACC.productDetail.bindThumbsCarouselCta();
148        ACC.productDetail.bindPrintPdp();
149        ACC.productDetail.bindShareLinks();
150        ACC.productDetail.initVideoFacades();
151    },
152
153    bindVariantOptions: function () {
154        ACC.productDetail.bindCurrentStyle();
155        ACC.productDetail.bindCurrentSize();
156        ACC.productDetail.bindCurrentType();
157    },
158
159    bindCurrentStyle: function () {
160        var currentStyle = $("#currentStyleValue").data("styleValue");
161        var styleSpan = $(".styleName");
162        if (currentStyle != null) {
163            styleSpan.text(": " + currentStyle);
164        }
165    },
166
167    bindCurrentSize: function () {
168        var currentSize = $("#currentSizeValue").data("sizeValue");
169        var sizeSpan = $(".sizeName");
170        if (currentSize != null) {
171            sizeSpan.text(": " + currentSize);
172        }
173    },
174
175    bindCurrentType: function () {
176        var currentSize = $("#currentTypeValue").data("typeValue");
177        var sizeSpan = $(".typeName");
178        if (currentSize != null) {
179            sizeSpan.text(": " + currentSize);
180        }
181    },
182
183    bindCarousels: function () {
184        ACC.productDetail.zoomInstances = [];
185        enquire.register("screen and (min-width:" + screenSm + ")", {
186            match: function () {
187                ACC.productDetail.bindThumbsCarousel();
188            }
189        });
190        enquire.register("screen and (min-width:" + screenSm + ")", {
191            match: function () {
192                ACC.productDetail.enableImageZoom();
193            },
194            unmatch: function () {
195                ACC.productDetail.resetImageZoom();
196            }
197        });
198        enquire.register("screen and (max-width:" + screenMd + ")", {
199            match: function () {
200                ACC.productDetail.bindMobileCarousel();
201            }
202        });
203    },
204
205    bindMobileCarousel: function () {
206        $('.js-carousel-mobile').slick({
207         	slidesToShow: 1,
208         	slidesToScroll: 1,
209         	arrows: true,
210             infinite: false
211         });
212         
213         function updateThumbsTabArrows() {
214             var $listEl = $('.js-carousel-thumbs-tab .slick-list');
215             var $slides = $('.js-carousel-thumbs-tab .slick-slide:not(.slick-cloned)');
216             if (!$listEl.length || !$slides.length) { return; }
217             var totalSlidesWidth = 0;
218             $slides.each(function () {
219                 totalSlidesWidth += $(this).outerWidth(true);
220             });
221             var overflowing = totalSlidesWidth > $listEl.outerWidth() + 1;
222             $('.js-carousel-thumbs-tab .slick-arrow').toggle(overflowing);
223         }
224
225         $('.js-carousel-thumbs-tab')
226         	.on('init', function(event, slick) {
227         		$('.js-carousel-thumbs-tab .slick-slide.slick-current').addClass('active-thumb');
228         		updateThumbsTabArrows();
229         	})
230         	.on('afterChange', updateThumbsTabArrows)
231         	.slick({
232         		variableWidth: true,
233         		slidesToScroll: 1,
234         		infinite: false,
235                arrows: true,
236         	});
237
238         $(window).on('resize', updateThumbsTabArrows);
239
240         var thumbClickInProgress = false;
241         $('.js-carousel-mobile').on('afterChange', function(event, slick, currentSlide) {
242         	if (!thumbClickInProgress) {
243         	    $('.js-carousel-thumbs-tab').slick('slickGoTo', currentSlide);
244         	}
245         	thumbClickInProgress = false;
246         	var currrentNavSlideElem = '.js-carousel-thumbs-tab .slick-slide[data-slick-index="' + currentSlide + '"]';
247         	$('.js-carousel-thumbs-tab .slick-slide.active-thumb').removeClass('active-thumb');
248         	$(currrentNavSlideElem).addClass('active-thumb');
249         });
250
251         $('.js-carousel-thumbs-tab').on('click', '.slick-slide', function(event) {
252         	event.preventDefault();
253         	thumbClickInProgress = true;
254         	var goToSingleSlide = $(this).data('slick-index');
255         	$('.js-carousel-mobile').slick('slickGoTo', goToSingleSlide);
256         });
257    },
258
259    bindThumbsCarousel: function () {
260    var $carousel = $(".js-carousel-thumbs")
261        if($carousel.hasClass("slick-initialized")) {
262            $carousel.slick("unslick");
263        }
264        $carousel.on('init', function(slick) {});
265        $carousel.not(".slick-initialized").slick ({
266            slidesToShow: 4,
267            slidesToScroll: 1,
268            vertical: true,
269            infinite:false
270        });
271    },
272
273    bindThumbsCarouselCta: function () {
274        $(".js-carousel-thumbs .js-carousel-item").hover(function(ev){
275            ev.preventDefault();
276
277            var $item = $(this),
278                $target = $(".js-carousel-target"),
279                image = $item.data("image"),
280                video = $item.data("video"),
281                zoom = $item.data("zoom"),
282                index = $item.data("index"),
283                $zoomNote = $(".js-zoomnote"),
284                $thumb = $item.find("> img");
285
286            if($target.length && !$thumb.hasClass("active-thumb")) {
287                if(video != '') {
288                    var $iframe = $target.find("iframe");
289                    // Only touch src if it's actually changing -- re-hovering
290                    // back onto the same video thumbnail after moving across
291                    // other thumbnails was re-setting the iframe to the same
292                    // URL every time, forcing a full reload (visible as a
293                    // blurry reload flash) instead of just re-showing what
294                    // was already loaded.
295                    if ($iframe.attr("src") !== video) {
296                        $iframe.attr("src", video);
297                    }
298                    $target.addClass("video-item");
299                    $zoomNote.addClass("video-item");
300                    ACC.productDetail.buildVideoFacade($iframe.closest(".video-wrapper"));
301                }
302                else if(image != '') {
303                    $target.find("#product-image")
304                           .attr("src", image)
305                           .attr("data-zoom", zoom);
306                    $target.removeClass("video-item");
307                    $zoomNote.removeClass("video-item");
308                }
309                if (index != 0)
310                {
311                    $target.find("#product-warranty-image").addClass("hidden");
312                }
313                else
314                {
315                    $target.find("#product-warranty-image").removeClass("hidden");
316                }
317                $item.siblings().find("> img").removeClass("active-thumb");
318                $thumb.addClass("active-thumb");
319            }
320        });
321    },
322
323    /* YouTube's own embed poster is whatever low-res default it auto-picks
324       (that's the blurry "Watch on YouTube" thumbnail) and we have no way
325       to control it from our CSS since it renders inside their iframe.
326       Instead, don't load the iframe until clicked: cover it with our own
327       <img> pulled straight from YouTube's thumbnail CDN (maxresdefault --
328       a real 1280x720 image we control, not their embed's internal
329       poster), falling back to hqdefault for older videos that don't have
330       a maxres thumbnail. Clicking swaps in the real iframe with autoplay. */
331    buildVideoFacade: function ($wrapper) {
332        if (!$wrapper || !$wrapper.length) { return; }
333        var $iframe = $wrapper.find("iframe");
334        var src = $iframe.attr("src") || "";
335        if (!src) {
336            $wrapper.find(".video-facade").remove();
337            return;
338        }
339        var match = src.match(/(?:youtube(?:-nocookie)?\.com\/(?:embed\/|watch\?v=)|youtu\.be\/)([a-zA-Z0-9_-]{6,})/);
340        if (!match) { return; }
341        var videoId = match[1];
342        var $existing = $wrapper.find(".video-facade");
343        if ($existing.length && $existing.data("videoId") === videoId) { return; }
344        $existing.remove();
345        var hqUrl = "https://i.ytimg.com/vi/" + videoId + "/hqdefault.jpg";
346        var maxUrl = "https://i.ytimg.com/vi/" + videoId + "/maxresdefault.jpg";
347        var $facade = $(
348            '<div class="video-facade">' +
349                '<img class="video-facade-img" src="' + maxUrl + '" alt="" onerror="this.onerror=null;this.src=\'' + hqUrl + '\';">' +
350                '<button type="button" class="video-facade-play" aria-label="Play video">' +
351                    '<svg width="68" height="48" viewBox="0 0 68 48"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.64 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="#1f1f1f" fill-opacity="0.8"></path><path d="M45 24 27 14v20" fill="#fff"></path></svg>
351' +
352                '</button>' +
353            '</div>'
354        );
355        $facade.data("videoId", videoId);
356        $wrapper.prepend($facade);
357        $facade.on("click", function () {
358            var playSrc = src + (src.indexOf("?") > -1 ? "&" : "?") + "autoplay=1";
359            $iframe.attr("src", playSrc);
360            $facade.remove();
361        });
362    },
363
364    initVideoFacades: function () {
365        $(".video-wrapper").each(function () {
366            ACC.productDetail.buildVideoFacade($(this));
367        });
368    },
369
370    bindPrintPdp: function () {
371        $(".js-print-pdp").click(function(ev){
372            ev.preventDefault();
373            window.print();
374        });
375    },
376
377    bindShareLinks: function () {
378        $(".js-share-link").click(function(ev){
379            ev.preventDefault();
380
381            var winTop = (screen.height / 2) - 250,
382                winLeft = (screen.width / 2) - 300,
383                url = $(this).attr("href");
384
385            window.open(
386                url.replace("®", "%AE"),
387                $(this).attr("title"),
388                "toolbar=0,status=0,width=600,height=500," +
389                "top=" + winTop + "," +
390                "left=" + winLeft);
391        });
392    },
393
394    bindImageZoom: function (trigger) {
395        var $zoomTrigger = $(trigger),
396            paneContainer = document.querySelector('.js-zoom-target');
397
398        $zoomTrigger.not(".zoom-set").each(function(x, el){
399            $(el).addClass("zoom-set");
400            var zoom = new Drift(el, {
401                paneContainer: paneContainer,
402                inlinePane: false,
403                hoverBoundingBox: true
404            });
405            ACC.productDetail.zoomInstances.push(zoom);
406        });
407    },
408
409    resetImageZoom: function () {
410        $.each(ACC.productDetail.zoomInstances, function(x, el) {
411            el.destroy();
412        });
413    },
414
415    enableImageZoom: function () {
416        var $zoomEls = $('.js-zoom-mobileTrigger, .js-zoom-trigger');
417
418        $zoomEls.each(function(x, el) {
419            $(el).removeClass("zoom-set");
420            ACC.productDetail.bindImageZoom(el);
421        });
422    },
423    bindSeeMore:function(){
424        var carLmt = 280;
425        var readMoreTxt =  "<span class='readMore'  title='Click to Show More'>See More</span>"
426        var readLessTxt = "<span class='readLess' title='Click to Show Less'>See Less</span>"
427        $(".addReadMore").each(function() {
428            if ($(this).find(".firstSec").length)
429                return;
430            var allstr = $(this).html();
431            if (allstr.length > carLmt) {
432                var firstSet = allstr.substring(0, carLmt);
433                var secdHalf = allstr.substring(0, allstr.length);
434                var strtoadd = firstSet+ "<span class='ShowMoreElip'>…</span>";
435                $(this).html(strtoadd+readMoreTxt);
436            }
437            $(document).on("click", ".readMore", function() {
438                $(this).closest(".addReadMore").toggleClass("showlesscontent");
439                $(".showlesscontent").html(secdHalf+readLessTxt)
440            });
441
442            $(document).on("click", ".readLess", function() {
443                $(this).closest(".addReadMore").toggleClass("showmorecontent");
444                $(".showmorecontent").html(strtoadd+readMoreTxt)
445            });
446        });
447        $('.panel-heading').click(function(e) {
448    		$parent = $(this).parent();
449    		var modalTarget = $parent.attr('data-toggle') === 'modal' && $parent.attr('data-target');
450    		if (modalTarget && window.innerWidth < 640) {
451    		    e.preventDefault();
452    		    e.stopPropagation();
453    		    $(modalTarget).modal('show');
454    		    return;
455    		}
456    		$content = $parent.children('.panel-collapse');
457    		$content.toggleClass('in');
458		});
459    },
460    bindCollapse:function(){
461        enquire.register("screen and (max-width:" + screenSm + ")", {
462            match: function () {
463                $('a[data-toggle="collapse"]').click(function(e){
464                    e.preventDefault();
465                    e.stopPropagation();
466                });
467
468            }
469        });
470    },
471
472    bindCreateFavList:function(){
473	    $('.js-create-link-fav').on('click',function() {
474        var qty=$(".js-qty-selector-input").val(),
475        productCode = $("#addToFav-new").attr("data-entryCode"),
476        query = productCode + "&" + qty,
477        $form=$(this).closest("form"),
478        listName=$.trim($("input[name='newWishlistName']").val()),
479        url = encodeURI(ACC.config.encodedContextPath
480                                + "/your-account/shoppingLists/addQuickProductToList/"
481                                + query
482                            );
483        if(!listName || listName.length == 0) {
484            var error = $form.find("#errorWishlist"),
485            errorMsg = error.attr("data-requiredMsg");
486            error.html(errorMsg).removeClass("hidden");
487            $form.addClass("has-error");
488            return false;
489        }
490        $.ajax({
491                type: "POST",
492                url: url,
493                data: $form.serialize(),
494                success : function(data) {
495                if(data.response == "error"){
496                  $("#errorWishlist").html(data.message).removeClass("hidden");
497                  $form.addClass("has-error");
498                }
499	            if(data.response == "success"){
500                   addToFavAction(listName);
501                }
502              }
503        });
504    });
505   },
506
507    bindAddToExistingFavList:function(){
508	$(".js-addToExitingFavList-cta").click(function(ev){
509    	    ev.preventDefault();
510    	    $('.list-option').removeClass('dropdown-item-highlighted');
511    		var $el = $(this),
512    		    listName = $el.attr("data-listName"),
513    		    listCode = $el.attr("data-listCode"),
514    		    qty=$(".js-qty-selector-input").val(),
515                productCode = $("#addToFav-new").attr("data-entryCode"),
516                query = productCode + "&" + qty,
517                url = $el.attr("href")+query;
518
519    	    $.ajax({
520                type: "POST",
521                url: url,
522                success: function(data) {
523	        if(data.response == "success"){
524               $el.next('.list-option').addClass('dropdown-item-highlighted');
525               }
526	    }
527	   });
528    	});
529   }
530
531};
532function shareProductUrl() {
533          var productUrlTxt = $("#productUrlInput");
534          productUrlTxt.select();
535          document.execCommand("copy");
536      }
537function addToFavCta() {
538     addToFavAction()
539     var addToDropdownEl = document.getElementById("addToDropdown");
540     if (addToDropdownEl) { addToDropdownEl.classList.toggle("show"); }
541     var wishListEl = document.getElementById("addToWishList-new");
542     if (wishListEl) { wishListEl.classList.remove('show'); }
543     var wishListBtnEl = document.getElementById("addToWishList-btn");
544     if (wishListBtnEl) { wishListBtnEl.classList.remove('wish-width'); }
545}
546
547function addToFavAction(listName){
548    $(this).next('.list-option').removeClass('dropdown-item-highlighted');
549	var qty=$(".js-qty-selector-input").val(),
550        productCode = $("#addToFav-new").attr("data-entryCode"),
551        query = productCode + "&" + qty,
552        url = encodeURI(ACC.config.encodedContextPath
553                                + "/your-account/shoppingLists/addProductToList/"
554                                + query+"?isPdp=true"
555                            );
556
557        $.ajax({
558                url: url,
559                type : "GET",
560                success : function(data) {
561                    var content = $(data);
562                    if(listName!=null && listName!='' && listName!='undefined'){
563                    $(content).find(".js-create-link-fav").closest('.dropdown-item').prev('.dropdown-scroll').find('.list-option:last').addClass('dropdown-item-highlighted');
564                    }
565
566                    $("#addToDropdown").html(content);
567                    $(".dropdown-scroll").animate({
568                        scrollTop: $(document).height()
569                    }, 500);
570                    ACC.productDetail.bindCreateFavList();
571                    ACC.productDetail.bindAddToExistingFavList();
572                }
573        });
574}
575
576function addToWishList() {
577    var wishListEl = document.getElementById("addToWishList-new");
578    if (wishListEl) {
579        wishListEl.classList.toggle("show");
580        wishListEl.classList.toggle("wish-width");
581    }
582    var wishListBtnEl = document.getElementById("addToWishList-btn");
583    if (wishListBtnEl) { wishListBtnEl.classList.toggle("wish-width"); }
584    var addToDropdownEl = document.getElementById("addToDropdown");
585    if (addToDropdownEl) { addToDropdownEl.classList.remove('show'); }
586}
587
588function bundleSeeMore() {
589    var $carousel = $(".bundle_row"),
590    $productGridList = $carousel.find(".bundle_col");
591    $carousel.slick({
592        infinite: false,
593        slidesToShow: 3,
594        slidesToScroll: 1,
595        arrows: true,
596        dots: false,
597        variableWidth: false,
598        responsive: [
599        {
600          breakpoint: 641,
601          settings: {
602            slidesToShow: 1,
603            slidesToScroll: 1,
604            arrows: false,
605            infinite: false,
606          },
607        },
608        {
609          breakpoint: 970,
610          settings: {
611            slidesToShow: 2,
612            slidesToScroll: 1,
613            infinite: false,
614          },
615        },
616        {
617          breakpoint: 1400,
618          settings: {
619            slidesToShow: 3,
620            slidesToScroll: 1,
621            infinite: false,
622          },
623        }
624      ],
625    });
626}
627$( document ).ready( bundleSeeMore );
628window.addEventListener("resize", bundleSeeMore);
629$('#pdpDescModel, #pdpSpceModel, #pdpResourceModel, #pdpReviewModel').on('show.bs.modal', function (e) {
630    if (window.innerWidth >= 640) {
631        return e.preventDefault();
632    }
633  });
634  $('#pdpItemShareBtn').on('click', function (e) {
635        $('.product-image_container').css({
636            position: 'static',
637        });
638  });
639  $(document).ready(function () {
640  setTimeout(function(){
641	  if($("#pr-reviewsnippet .pr-snippet-review-count").html() != undefined){
642      var reviewCount = $("#pr-reviewsnippet .pr-snippet-review-count").html().split(' ')[0];
643      if(reviewCount !== "No") {
644        $("#pr-reviewsnippet .pr-snippet-review-count, #pr-reviewsnippet-mobile .pr-snippet-review-count, #pr-reviewsnippet-tab .pr-snippet-review-count, #pr-reviewsnippetSpec .pr-snippet-review-count, #pr-reviewsnippetDesc .pr-snippet-review-count, #pr-reviewsnippetResource .pr-snippet-review-count").html( reviewCount );
645        }
646        }
647        }, 2500);
648        
649  });
650//window.addEventListener("click", function( ) {
651//    document.getElementById("addToDropdown").classList.remove('show');
652//    document.getElementById("addToWishList-new").classList.remove('show');
653//    document.getElementById("addToWishList-btn").style.width = "205px";
654//});
655
656/* ============================================================
657   APPEND BELOW TO THE END OF acc.productDetail.js
658   (after the existing "$('#pdpItemShareBtn').on('click', ...)"
659   and review-count blocks already in the file)
660   ============================================================ */
661
662/* ---- Disable the Drift.js hover-zoom side panel ------- */
663if (window.ACC && ACC.productDetail) {
664    ACC.productDetail.enableImageZoom = function () {};
665    ACC.productDetail.bindImageZoom = function () {};
666    ACC.productDetail.resetImageZoom = function () {};
667}
668
669/* ---- PDP click-to-zoom lightbox ------- */
670(function ($) {
671    var initialized = false;
672
673    $(function () {
674        var $modal = $('#pdpZoomModal');
675        if ($modal.length && $modal.parent().is('body') === false) {
676            $modal.appendTo('body');
677        }
678    });
679
680    function initZoom() {
681        if (initialized) { return; }
682
683        var $slides = $('.pdp-zoom-slide');
684        var $thumbs = $('.pdp-zoom-thumb');
685
686        function showSlide(index) {
687            $slides.removeClass('is-active').eq(index).addClass('is-active');
688            $thumbs.removeClass('is-active').eq(index).addClass('is-active');
689        }
690
691        $thumbs.on('click', function () {
692            showSlide($(this).index());
693        });
694
695        $('.js-pdp-zoom-next').on('click', function () {
696            $('.js-pdp-zoom-thumbs').animate({ scrollLeft: '+=200' }, 200);
697        });
698
699        $('.js-pdp-zoom-prev').on('click', function () {
700            $('.js-pdp-zoom-thumbs').animate({ scrollLeft: '-=200' }, 200);
701        });
702
703        showSlide(0);
704        initialized = true;
705    }
706
707    function updateZoomArrows() {
708        var $thumbsEl = $('.js-pdp-zoom-thumbs')[0];
709        if (!$thumbsEl) { return; }
710        var overflowing = $thumbsEl.scrollWidth > $thumbsEl.clientWidth + 1;
711        $('.js-pdp-zoom-prev, .js-pdp-zoom-next').toggle(overflowing);
712    }
713
714    function openZoomAt(index) {
715        $('#pdpZoomModal').modal('show');
716        $('#pdpZoomModal').off('shown.bs.modal.pdpZoom').one('shown.bs.modal.pdpZoom', function () {
717            initZoom();
718            updateZoomArrows();
719            var $slides = $('.pdp-zoom-slide');
720            var $thumbs = $('.pdp-zoom-thumb');
721            $slides.removeClass('is-active').eq(index || 0).addClass('is-active');
722            $thumbs.removeClass('is-active').eq(index || 0).addClass('is-active');
723        });
724    }
725
726    $(document).on('click', '.js-zoom-trigger, .js-pdp-zoom-open', function (e) {
727        e.preventDefault();
728        var currentIndex = $('.js-carousel-thumbs .js-carousel-item img.active-thumb').closest('.js-carousel-item').data('index');
729        if (currentIndex === undefined) {
730            currentIndex = $('.js-carousel-thumbs-tab .js-carousel-item img.active-thumb').closest('.js-carousel-item').data('index');
731        }
732        openZoomAt(currentIndex || 0);
733    });
734
735    $(document).on('click', '.js-carousel-thumbs .js-carousel-item, .js-carousel-thumbs-tab .js-carousel-item', function () {
736        if (!initialized) { return; }
737        var index = $(this).data('index') || 0;
738        $('.pdp-zoom-slide').removeClass('is-active').eq(index).addClass('is-active');
739        $('.pdp-zoom-thumb').removeClass('is-active').eq(index).addClass('is-active');
740    });
741})(jQuery);
742
743/* ---- Favorite heart toggle on PDP image ------- */
744(function ($) {
745    $(document).on('click', '.js-add-favorite', function (e) {
746        e.preventDefault();
747        e.stopPropagation();
748        var $btn = $(this);
749        var pressed = $btn.attr('aria-pressed') === 'true';
750
751        $btn.attr('aria-pressed', String(!pressed));
752
753        var $wishlistTrigger = $('#addToWishList-btn');
754        var $favListTrigger = $('#addToFav-new');
755        if ($wishlistTrigger.length) {
756            $wishlistTrigger.closest('.dropdown').addClass('open');
757            addToWishList();
758        } else if ($favListTrigger.length) {
759            $favListTrigger.closest('.dropdown').addClass('open');
760            addToFavCta();
761        } else {
762            window.location.href = '/login';
763        }
764    });
765})(jQuery);
766
767/* ---- Close the "add to list" favorites modal ------- */
768(function ($) {
769    $(document).on('click', '.js-pdp-fav-modal-close', function (e) {
770        e.preventDefault();
771        $(this).closest('.dropdown').removeClass('open');
772    });
773    // Clicking the dark overlay itself (not the white card) closes it too.
774    $(document).on('click', '.js-pdp-fav-modal-wrapper', function (e) {
775        if (e.target === this) {
776            $(this).closest('.dropdown').removeClass('open');
777        }
778    });
779})(jQuery);
780
781/* ---- Real Description/Specifications/Resources/Need-help- */
782(function ($) {
783    $(document).on('click', '.js-pdp-tabs-nav .pdp-tabs-nav__btn', function () {
784        var $btn = $(this);
785        var $nav = $btn.closest('.js-pdp-tabs-nav');
786        var $panels = $nav.next('.js-pdp-tabs-panels');
787        var targetId = $btn.data('pdp-tab');
788
789        $nav.find('.pdp-tabs-nav__btn').removeClass('is-active');
790        $btn.addClass('is-active');
791
792        $panels.find('.panel').each(function () {
793            var $panel = $(this);
794            var isMatch = $panel.find('.panel-collapse').attr('id') === targetId;
795            $panel.toggleClass('is-active-panel', isMatch);
796            $panel.find('.panel-collapse').toggleClass('in', isMatch);
797        });
798    });
799
800    $(function () {
801        $('.js-pdp-tabs-panels').each(function () {
802            var $panels = $(this);
803            var firstId = $panels.prev('.js-pdp-tabs-nav').find('.pdp-tabs-nav__btn').first().data('pdp-tab');
804            $panels.find('.panel').each(function () {
805                var $panel = $(this);
806                var isMatch = $panel.find('.panel-collapse').attr('id') === firstId;
807                $panel.toggleClass('is-active-panel', isMatch);
808                $panel.find('.panel-collapse').toggleClass('in', isMatch);
809            });
810        });
811    });
812})(jQuery);
813
814/* ---- Move delivery estimate below the qty/cart row -------- */
815(function ($) {
816    $(function () {
817        $('.purchase').each(function () {
818            var $purchase = $(this);
819            var $estimate = $purchase.find('.qty-selector .delivery-estimate-section.visible-lg.visible-md');
820            if ($estimate.length) {
821                $purchase.append($estimate);
822            }
823        });
824    });
825})(jQuery);
826
827/* ---- Auto-color the text-pill variant options --------- */
828(function ($) {
829    var colorNameMap = {
830        'apple green': '#8DB600'
831    };
832
833    function resolveColor(name) {
834        var key = name.trim().toLowerCase();
835        if (colorNameMap[key]) { return colorNameMap[key]; }
836
837        var probe = document.createElement('div');
838        probe.style.color = '';
839        probe.style.color = key;
840        return probe.style.color !== '' ? key : null;
841    }
842
843    $('.option-list.option-list--text li a').each(function () {
844        var $link = $(this);
845        var name = $link.text().trim();
846        var color = resolveColor(name);
847
848        if (color) {
849            $link.css('background-color', color);
850            $link.closest('.option-list').addClass('option-list--auto-color');
851            $link.attr('title', name);
852        }
853    });
854})(jQuery);
855/* ---- Relocate the Bloomreach "Need help choosing" widget ----- */
856(function () {
857    function getTarget() {
858        if (window.innerWidth < 641) {
859            return document.getElementById('pdpHelpChoosingTargetMobileTop') || document.getElementById('pdpHelpChoosingTarget');
860        }
861        return document.getElementById('pdpHelpChoosingTarget');
862    }
863    var target = getTarget();
864    if (!target) { return; }
865
866    function moveWidget() {
867        var widget = document.querySelector('.clarity-trigger-pdp_embedded');
868        if (widget && widget.parentElement !== target) {
869            target.appendChild(widget);
870            return true;
871        }
872        return false;
873    }
874
875    if (moveWidget()) { return; }
876
877    var observer = new MutationObserver(function () {
878        if (moveWidget()) {
879            observer.disconnect();
880        }
881    });
882    observer.observe(document.body, { childList: true, subtree: true });
883    setTimeout(function () { observer.disconnect(); }, 15000);
884})();
885

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.