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EAAE,kBAAkBgC,OACpBhC,EAAE,kBAAkBS,YAAY,QAE5BT,EAAE0B,QAAQY,QAAU,KACpBtC,EAAE,mBAAmB+B,OAAOtB,YAAY,OAE5C8B,QAAQC,IAAIzB,EAAUD,KAAK,QAAQ,IACnCd,EAAEe,GAAWb,KAAK,MAAOa,EAAUD,KAAK,QAAQD,GACpD,CAGAb,EAAE,QAAQM,KAAK,oBAAoBG,YAAY,iBAC/CT,EAAEmC,GAAiBxB,SAAS,gBAChC,CAGAX,EAAEyC,UAAUC,OAAM,WACd,GAAIhB,OAAOiB,SAASC,KAAKxC,OAAS,EAAG,CACjC,IAAMyC,EAAYnB,OAAOiB,SAASC,KAAKE,OAAO,EAAGpB,OAAOiB,SAASC,KAAKxC,OAAS,GAEzE2C,EAAS/C,EAAE,QAAQM,KAAK,oBAADM,OAAqBiC,IAE9CE,EAAO3C,QACPP,EAAekD,EAEvB,CAEA/C,EAAE0B,QAAQsB,QAAO,WACThD,EAAE,mBAAmBoC,SAAS,QAAUpC,EAAE0B,QAAQY,QAAU,KAC5DJ,EAAoBlC,EAAE,6BAA6BM,KAAK,qBACxDN,EAAE,mBAAmBS,YAAY,OAAOwB,WAAW,UAEnDjC,EAAE,mBAAmBiC,WAAW,QAExC,IAGAjC,EAAEyC,UAAUQ,GAAG,QAAS,oBAAoB,SAAUC,GAClDA,EAAEC,iBACFtD,EAAeuD,KACnB,IAGApD,EAAEyC,UAAUQ,GAAG,aAAc,oBAAoB,SAAUC,GACvDrD,EAAeuD,KACnB,IAGApD,EAAEyC,UAAUQ,GAAG,QAAS,0BAA0B,WAC9Cf,EAAoBkB,KACxB,IAGApD,EAAEyC,UAAUQ,GAAG,aAAc,0BAA0B,WACnDf,EAAoBkB,KACxB,GACJ,G","sources":["webpack://brita-ca/./js/src/components/product-rollovers.js"],"sourcesContent":["function switchToSwatch(tappedSwatch) {\n const colorPickerGroup = $(tappedSwatch).parent(); // ul.color-picker\n\n if (\n colorPickerGroup.parent().attr('class').indexOf('filter-dropdown') > -1 ||\n $(tappedSwatch).parent('#color-picker-modal').length\n ) {\n return; // Filtering dropdown - clicks are handled separtely\n }\n\n const previousSwatch = $(colorPickerGroup).find('li.selectedColor');\n\n const newColor = $(tappedSwatch).attr('class').split(' ')[0];\n\n previousSwatch.removeClass('selectedColor');\n const previousColor = previousSwatch.attr('class').split(' ')[0];\n $(tappedSwatch).addClass('selectedColor');\n\n previousSwatch.find('button').attr('aria-label', `Switch to ${previousColor}`);\n $(tappedSwatch).find('button').attr('aria-label', `Currently selected color - ${newColor}`);\n\n const imgKey = $(tappedSwatch).data('imgid');\n\n const targetImg = $('body').find(`div.hero .primary-image#${$(tappedSwatch).data('target')}`);\n\n const targetImgData = jQuery.parseJSON(targetImg.attr('data-imgs'));\n\n if ($(targetImg)) {\n $(targetImg).attr('src', targetImgData[imgKey]);\n }\n\n if ($(tappedSwatch).data('price') !== undefined) {\n if (Electro.language === 'fr') {\n const frenchPrice = $(tappedSwatch).data('price').toString().replace('.', ',');\n // Handles change on Category pages.\n $(colorPickerGroup).parent().find('span.price').text(`${frenchPrice} $`);\n\n // Handles change on PDP pages.\n $('.product-info span.price').text(`${frenchPrice} $`);\n } else {\n // Handles change on Category pages.\n $(colorPickerGroup)\n .parent()\n .find('span.price')\n .text(`$${$(tappedSwatch).data('price')}`);\n\n // Handles change on PDP pages.\n $('.product-info span.price').text(`$${$(tappedSwatch).data('price')}`);\n }\n }\n\n if ($(tappedSwatch).data('upc') !== undefined) {\n window.selectedProductUPC = $(tappedSwatch).data('upc');\n // console.info('window.selectedProductUPC: ', window.selectedProductUPC);\n }\n\n const pdpLinks = $(colorPickerGroup).parent().find('a');\n\n if (pdpLinks.length > 0) {\n for (let i = 0; i < pdpLinks.length; i += 1) {\n // look for nearby PDP links that need the selected color\n if (\n ($(pdpLinks[i]).attr('id') && $(pdpLinks[i]).attr('id').indexOf('pw-') > -1) ||\n ($(pdpLinks[i]).attr('id') && $(pdpLinks[i]).attr('id').indexOf('review') > -1)\n ) {\n // continue; // avoid social sharing icons\n } else if ($(pdpLinks[i]).attr('id') && $(pdpLinks[i]).attr('href').indexOf('/products/') > 0) {\n const href = $(pdpLinks[i]).attr('href').split('#')[0];\n $(pdpLinks[i]).attr('href', `${href}#${newColor}`);\n }\n }\n }\n\n if ($('div.interactive-thumbs').length) {\n // PDP has interactive thumbs and hero images to hide and show\n $('body').find(`div.interactive-thumbs img.${previousColor}`).parent().hide();\n $('body').find(`div.interactive-thumbs img.${newColor}`).parent().show();\n $('div.interactive-thumbs ul').find('li').removeClass('shownFullsize');\n $('div.interactive-thumbs ul').find('li:visible:first').addClass('shownFullsize');\n $('.curated-review').removeClass('foo').removeAttr('style');\n $('.primary-image').removeClass('zoom');\n $('.primary-image').show();\n }\n}\n\n// Load the full-size primary-image corresponding to the tapped thumbnail\nfunction showImgForThumbnail(tappedThumbnail) {\n if ($(tappedThumbnail).hasClass('quote-thumb')) {\n $('.primary-image').hide();\n $('.curated-review').css('display', 'flex').addClass('foo');\n } else if ($(tappedThumbnail).hasClass('video-thumb')) {\n return; // bootstrap.js will open the modal automatically\n } else {\n const imgKey = $(tappedThumbnail).find('img').data('imgid');\n // var targetImg = $('body').find('div.hero .primary-image#' + $(tappedThumbnail).find('img').data('target')); --modified var...this was breaking the image swatch\n const targetImg = $('body').find('div.hero .primary-image');\n\n $('.primary-image').show();\n $('.primary-image').removeClass('zoom');\n\n if ($(window).width() < 769) {\n $('.curated-review').hide().removeClass('foo');\n }\n console.log(targetImg.data('imgs')[0]);\n $(targetImg).attr('src', targetImg.data('imgs')[imgKey]);\n }\n\n // Change which tumbnail is selected\n $('body').find('li.shownFullsize').removeClass('shownFullsize');\n $(tappedThumbnail).addClass('shownFullsize');\n}\n\n// Add handlers for desktop clicks and mobile taps\n$(document).ready(() => {\n if (window.location.hash.length > 0) {\n const hashColor = window.location.hash.substr(1, window.location.hash.length - 1);\n\n const swatch = $('body').find(`.color-picker li.${hashColor}`);\n\n if (swatch.length) {\n switchToSwatch(swatch);\n }\n }\n\n $(window).resize(() => {\n if ($('.curated-review').hasClass('foo') && $(window).width() > 768) {\n showImgForThumbnail($('div.interactive-thumbs ul').find('li:visible:first'));\n $('.curated-review').removeClass('foo').removeAttr('style');\n } else {\n $('.curated-review').removeAttr('style');\n }\n });\n\n // Desktop handler for color picker swatch clicks\n $(document).on('click', '.color-picker li', function (e) {\n e.preventDefault();\n switchToSwatch(this);\n });\n\n // Touchscreen handler for color picker swatch taps\n $(document).on('touchstart', '.color-picker li', function (e) {\n switchToSwatch(this);\n });\n\n // Desktop handler for interactive thumb clicks\n $(document).on('click', '.interactive-thumbs li', function () {\n showImgForThumbnail(this);\n });\n\n // Touchscreen handler for interactive thumb taps\n $(document).on('touchstart', '.interactive-thumbs li', function () {\n showImgForThumbnail(this);\n });\n});\n"],"names":["switchToSwatch","tappedSwatch","colorPickerGroup","$","parent","attr","indexOf","length","previousSwatch","find","newColor","split","removeClass","previousColor","addClass","concat","imgKey","data","targetImg","targetImgData","jQuery","parseJSON","undefined","Electro","language","frenchPrice","toString","replace","text","window","selectedProductUPC","pdpLinks","i","href","hide","show","removeAttr","showImgForThumbnail","tappedThumbnail","hasClass","css","width","console","log","document","ready","location","hash","hashColor","substr","swatch","resize","on","e","preventDefault","this"],"sourceRoot":""}