{"version":3,"sources":["index.js"],"names":["define","require","SocialButton","i","socialButtons","document","querySelectorAll","length","element","type","getAttribute","initiate","window","assets","packshot","LazyLoad","lazyload","model","galleryTop","Swiper","slidesPerView","centeredSlides","spaceBetween","pagination","el","clickable","paginationClickable","zoom","nextButton","prevButton","paginationBulletRender","swiper","index","className","on","sw","j","slides","vid","$","children","pause","elm","getElementById","activeIndex","addClass","removeClass","sl","hasClass","play","Recommendation","postal","recommendations","recommendationsObjects","push","isRecommendationsReady","ready","clearInterval","waitForAllRecommendations","setInterval","channel","publish","topic","data","voucher","addPrices","ProductButtons","querySelector","Arrows","images","backButton","modal"],"mappings":"AAAAA,OAAA,yBAAA,WACA,YAEAC,UAAA,wBAAA,SAAAC,cACA,GACAC,GADAC,cAAAC,SAAAC,iBAAA,mBAEA,KAAAH,EAAA,EAAAA,EAAAC,cAAAG,SAAAJ,EACA,GAAAD,eACAM,QAAAJ,cAAAD,GACAM,KAAAL,cAAAD,GAAAO,aAAA,qBACAC,aAIAC,OAAAC,OAAAD,OAAAC,WAEAZ,SAAA,oBAAA,SAAAa,UACAF,OAAAC,OAAAC,SAAAA,SACAF,OAAAC,OAAAC,SAAAH,SAAA,gBAKAV,SAAA,oBAAA,SAAAc,UACAH,OAAAC,OAAAG,UAAA,GAAAD,WAAAJ,aAEAV,SAAA,UAAA,SAAAgB,OACA,GASAC,aATA,GAAAC,QAAA,aACAC,cAAA,OACAC,gBAAA,EACAC,aAAA,GACAC,YACAC,GAAA,qBACAC,WAAA,KAGA,GAAAN,QAAA,gBACAI,WAAA,qBACAG,qBAAA,EACAC,MAAA,EACAC,WAAA,sBACAC,WAAA,sBACAC,uBAAA,SAAAC,OAAAC,MAAAC,WACA,MAAA,gBAAAA,UAAA,eAGAf,YAAAgB,GAAA,qBAAA,SAAAC,IACA,IAAA,GAAAC,GAAA,EAAAA,EAAAD,GAAAE,OAAA9B,OAAA6B,IAAA,CACA,GAAAE,KAAAC,EAAAJ,GAAAE,OAAAD,IAAAI,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AAC,OAAAyD,WAAAA,WACA1D,OAAAC,OAAAyD,WAAA3D,SAAA,gBAKAV,SAAA,iBAAA,SAAAsE,OACA3D,OAAAC,OAAA0D,MAAAA,MACA3D,OAAAC,OAAA0D,MAAA5D,SAAA","file":"index.js","sourcesContent":["define('views/product/index',[],function () {\r\n\t'use strict';\r\n\r\n\trequire(['classes/socialbutton'], function (SocialButton) {\r\n\t\tvar socialButtons = document.querySelectorAll('#share-buttons a'),\r\n\t\t\ti;\r\n\t\tfor (i = 0; i < socialButtons.length; ++i) {\r\n\t\t\tnew SocialButton({\r\n\t\t\t\telement: socialButtons[i],\r\n\t\t\t\ttype: socialButtons[i].getAttribute('data-share-type')\r\n\t\t\t}).initiate();\r\n\t\t}\r\n\t});\r\n\r\n\twindow.assets = window.assets || {};\r\n\r\n\trequire(['classes/packshot'], function (packshot) {\r\n\t\twindow.assets.packshot = packshot;\r\n\t\twindow.assets.packshot.initiate(function () {\r\n\t\t\tconsole.log('packshot initiated the old way');\r\n\t\t});\r\n\t});\r\n\n\trequire(['classes/lazyload'], function (LazyLoad) {\r\n\t\twindow.assets.lazyload = new LazyLoad().initiate();\r\n\t});\r\n\trequire(['swiper'], function (model) {\r\n\t\tvar swiper = new Swiper(\".mySwiper\", {\r\n\t\t\tslidesPerView: \"auto\",\r\n\t\t\tcenteredSlides: true,\r\n\t\t\tspaceBetween: 30,\r\n\t\t\tpagination: {\r\n\t\t\t\tel: \".swiper-pagination\",\r\n\t\t\t\tclickable: true,\r\n\t\t\t},\r\n\t\t});\r\n\t\tvar galleryTop = new Swiper('.gallery-top', {\r\n\t\t\tpagination: '.swiper-pagination',\r\n\t\t\tpaginationClickable: true,\r\n\t\t\tzoom: false,\r\n\t\t\tnextButton: '.swiper-button-next',\r\n\t\t\tprevButton: '.swiper-button-prev',\r\n\t\t\tpaginationBulletRender: function (swiper, index, className) {\r\n\t\t\t\treturn '';\r\n\t\t\t},\r\n\t\t});\r\n\t\tgalleryTop.on('onSlideChangeStart', function (sw) {\r\n\t\t\tfor (var j = 0; j < sw.slides.length; j++) {\r\n\t\t\t\tvar vid = $(sw.slides[j]).children(\"a\").children(\"video\")[0];\r\n\t\t\t\t\tif (vid) {\r\n\t\t\t\t\t\tvid.pause();\r\n\t\t\t\t\t\tconsole.log('paused vid')\r\n\t\t\t\t\t}\r\n\t\t\t\t\tvar elm = document.getElementById('thumb_' + j);\r\n\t\t\t\t\tif (j == sw.activeIndex) {\r\n\t\t\t\t\t\t$(elm).addClass('selected');\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t$(elm).removeClass('selected');\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\tgalleryTop.on('onSlideChangeEnd', function (sw) {\r\n\t\t\tvar sl = sw.slides[sw.activeIndex];\r\n\t\t\tif ($(sl).hasClass('gallery-top-video-slide')) {\r\n\t\t\t\tconst vid = $(sl).children(\"a\").children(\"video\")[0];\r\n\t\t\t\tvid.play();\r\n\t\t\t\tconsole.log('started vid');\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t\t//galleryTop.on('onSlideChangeStart', function (sw) {\r\n\t\t//\tfor (var j = 0; j < sw.slides.length; j++) {\r\n\t\t//\t\tvar elm = document.getElementById('thumb_' + j);\r\n\t\t//\t\tif (j == sw.activeIndex) {\r\n\t\t//\t\t\t$(elm).addClass('selected');\r\n\t\t//\t\t} else {\r\n\t\t//\t\t\t$(elm).removeClass('selected');\r\n\t\t//\t\t}\r\n\t\t//\t}\r\n\t\t//});\r\n\t\t//galleryTop.on('onSlideChangeEnd', function (sw) {\r\n\t\t//});\r\n\r\n\t/*require(['classes/recommendations'], function(recommendations) {\r\n\t\twindow.assets.recommendations = recommendations;\r\n\t\twindow.assets.recommendations.initiate(function() {\r\n\t\t\tconsole.log('recommendations initiated the old way');\r\n\t\t});\r\n\t});*/\r\n\trequire(['classes/recommendation', 'postal'], function(Recommendation, postal) {\r\n\t\tvar recommendations = document.querySelectorAll('.recommendations'),\r\n\t\t\ti,\r\n\t\t\trecommendationsObjects = [];\r\n\t\tfor (i = 0; i < recommendations.length; ++i) {\r\n\t\t\trecommendationsObjects.push(new Recommendation({\r\n\t\t\t\telement: recommendations[i],\r\n\t\t\t\ttype: recommendations[i].getAttribute('data-recommendation-type')\r\n\t\t\t}).initiate());\r\n\t\t}\r\n\r\n\t\tvar isRecommendationsReady = function() {\r\n\t\t\tfor (i = 0; i < recommendations.length; ++i) {\r\n\t\t\t\tif (!recommendationsObjects[i].ready) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tclearInterval(waitForAllRecommendations);\r\n\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\tvar waitForAllRecommendations = setInterval(function() {\r\n\t\t\tif (isRecommendationsReady()) {\r\n\t\t\t\tpostal.channel('nosto').publish({\r\n\t\t\t\t\ttopic: 'recommendation.all',\r\n\t\t\t\t\tdata: function () {\r\n\r\n\t\t\t\t\t postal.channel('recommendation').publish({\r\n\t\t\t\t\t topic: 'render'\r\n\t\t\t\t\t });\r\n\t\t\t\t\t if (window.assets.voucher) {\r\n\t\t\t\t\t window.assets.voucher.addPrices();\r\n\t\t\t\t\t }\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}, 200);\r\n\t\t\r\n\t});\r\n\r\n\t/*require(['classes/productcollection'], function(collection) {\r\n\t\twindow.assets.collection = collection;\r\n\t\twindow.assets.collection.initiate(function() {\r\n\t\t\tconsole.log('collection initiated the old way');\r\n\t\t});\r\n\t});\r\n\r\n\trequire(['classes/swipeband'], function(swipeBand) {\r\n\t\twindow.assets.swipeBand = swipeBand;\r\n\t\twindow.assets.swipeBand.initiate(function() {\r\n\t\t\tconsole.log('swipeBand initiated the old way');\r\n\t\t});\r\n\t});*/\r\n\r\n\t/*require(['classes/productdetails'], function(productDetails) {\r\n\t\twindow.assets.productDetails = productDetails;\r\n\t\twindow.assets.productDetails.initiate(function() {\r\n\t\t\tconsole.log('productDetails initiated the old way');\r\n\t\t});\r\n\t});*/\r\n\r\n\trequire(['classes/productbuttons'], function(ProductButtons) {\r\n\t\tnew ProductButtons({\r\n\t\t\telement: document.querySelector('#specifications div.controls')\r\n\t\t}).initiate();\r\n\t});\r\n\r\n\trequire(['classes/arrows'], function(Arrows) {\r\n\t\tnew Arrows({\r\n\t\t\telement: document.querySelector('#arrows')\r\n\t\t}).initiate();\r\n\t});\r\n\r\n\r\n\trequire(['classes/images'], function(images) {\r\n\t\twindow.assets.images = images;\r\n\t\twindow.assets.images.initiate(function() {\r\n\t\t\tconsole.log('images initiated the old way');\r\n\t\t});\r\n\t});\r\n\r\n\t/*require(['classes/social'], function(social) {\r\n\t\twindow.assets.social = social;\r\n\t\twindow.assets.social.initiate(function() {\r\n\t\t\tconsole.log('social initiated the old way');\r\n\t\t});\r\n\t});*/\r\n\r\n\trequire(['classes/backbutton'], function(backButton) {\r\n\t\twindow.assets.backButton = backButton;\r\n\t\twindow.assets.backButton.initiate(function() {\r\n\t\t\tconsole.log('backButton initiated the old way');\r\n\t\t});\r\n\t});\r\n\r\n\trequire(['classes/modal'], function(modal) {\r\n\t\twindow.assets.modal = modal;\r\n\t\twindow.assets.modal.initiate(function() {\r\n\t\t\tconsole.log('modal initiated the old way');\r\n\t\t});\r\n\t});\r\n\r\n\t/*window.assets.packshot = require('classes/packshot');\r\n\twindow.assets.packshot.initiate(function() {\r\n\t\tconsole.log('packshot initiated the old way');\r\n\t});\r\n\r\n\twindow.assets.images = require('classes/images');\r\n\twindow.assets.images.initiate(function() {\r\n\t\tconsole.log('images initiated the old way');\r\n\t});\r\n\r\n\twindow.assets.social = require('classes/social');\r\n\twindow.assets.social.initiate(function() {\r\n\t\tconsole.log('social initiated the old way');\r\n\t});\r\n\r\n\twindow.assets.productDetails = require('classes/productdetails');\r\n\twindow.assets.productDetails.initiate(function() {\r\n\t\tconsole.log('productDetails initiated the old way');\r\n\t});\r\n\r\n\twindow.assets.backButton = require('classes/backbutton');\r\n\twindow.assets.backButton.initiate(function() {\r\n\t\tconsole.log('backButton initiated the old way');\r\n\t});\r\n\r\n\twindow.assets.modal = require('classes/modal');\r\n\twindow.assets.modal.initiate(function() {\r\n\t\tconsole.log('modal initiated the old way');\r\n\t});\r\n\t*/\r\n});\n"]}