{"version":3,"sources":["src/scripts/components/sticky-live-event.js"],"names":["$","jQuery","init","length","videoContainer","stickyModule","stickyClose","videoPosition","hideShow","scrollPos","window","scrollTop","hasClass","addClass","hideModule","updateVideoBottom","offset","top","outerHeight","on","event","preventDefault","remove","off","module","removeClass"],"mappings":";;;;;;;AACA;;AADA,IAAIA,IAAIC,MAAR;;;AAIA,SAASC,IAAT,GAAgB;;AAEd,MAAGF,EAAE,gBAAF,EAAoBG,MAAvB,EAA+B;AAC7B,QAAMC,iBAAiBJ,EAAE,iBAAF,CAAvB;AACA,QAAMK,eAAeL,EAAE,gBAAF,CAArB;AACA,QAAMM,cAAcN,EAAE,sBAAF,CAApB;AACA,QAAIO,gBAAiB,CAArB;;AAEA,QAAIC,WAAW,yBAAS,YAAW;AACjC,UAAIC,YAAYT,EAAEU,MAAF,EAAUC,SAAV,EAAhB;AACA,UAAGF,YAAYF,aAAZ,IAA6B,CAACF,aAAaO,QAAb,CAAsB,WAAtB,CAAjC,EAAqE;AACnEP,qBAAaQ,QAAb,CAAsB,WAAtB;AACD,OAFD,MAGK,IAAGJ,YAAYF,aAAZ,IAA6BF,aAAaO,QAAb,CAAsB,WAAtB,CAAhC,EAAoE;AACvEE,mBAAWT,YAAX;AACD;AACF,KARc,EAQZ,EARY,CAAf;;AAUA,QAAIU,oBAAoB,yBAAS,YAAW;AAC1CR,sBAAgBH,eAAeY,MAAf,GAAwBC,GAAxB,GAA8Bb,eAAec,WAAf,EAA9C;AACD,KAFuB,CAAxB;;AAIAH;;AAEA;AACAf,MAAEU,MAAF,EAAUS,EAAV,CAAa,QAAb,EAAuBX,QAAvB;;AAEA;AACAR,MAAEU,MAAF,EAAUS,EAAV,CAAa,QAAb,EAAuBJ,iBAAvB;;AAEAT,gBAAYa,EAAZ,CAAe,OAAf,EAAwB,UAASC,KAAT,EAAgB;AACtCA,YAAMC,cAAN;AACAhB,mBAAaiB,MAAb;AACAtB,QAAEU,MAAF,EAAUa,GAAV,CAAc,QAAd,EAAwBf,QAAxB;AACAR,QAAEU,MAAF,EAAUa,GAAV,CAAc,QAAd,EAAwBR,iBAAxB;AACA;AACD,KAND;;AAQA;;;;;;;AAOD;;AAED,WAASD,UAAT,CAAoBU,MAApB,EAA4B;AAC1BA,WAAOC,WAAP,CAAmB,WAAnB;AACD;AACF;;QAEevB,I,GAARA,I","file":"sticky-live-event.js","sourcesContent":["var $ = jQuery;\nimport {debounce} from '../utils/utilities.js';\n\n\nfunction init() {\n\n if($('.event__sticky').length) {\n const videoContainer = $('.video__wrapper');\n const stickyModule = $('.event__sticky');\n const stickyClose = $('.event__sticky-close');\n let videoPosition = 0;\n\n var hideShow = debounce(function() {\n let scrollPos = $(window).scrollTop();\n if(scrollPos > videoPosition && !stickyModule.hasClass('_expanded')) {\n stickyModule.addClass('_expanded');\n }\n else if(scrollPos < videoPosition && stickyModule.hasClass('_expanded')) {\n hideModule(stickyModule);\n }\n }, 50);\n\n var updateVideoBottom = debounce(function() {\n videoPosition = videoContainer.offset().top + videoContainer.outerHeight();\n });\n\n updateVideoBottom();\n\n //binds scroll to hide and show the module\n $(window).on('scroll', hideShow);\n\n //reset video position variable on resize\n $(window).on('resize', updateVideoBottom);\n\n stickyClose.on('click', function(event) {\n event.preventDefault();\n stickyModule.remove();\n $(window).off('scroll', hideShow);\n $(window).off('resize', updateVideoBottom);\n //$('.event__sticky-wrapper a').off('click');\n });\n\n /*/scroll to video when clicking on the links of the sticky module\n $('.event__sticky-wrapper a').on('click', function(event) {\n event.preventDefault();\n $('html, body').animate({\n scrollTop: videoContainer.offset().top\n }, 1000);\n });*/\n }\n\n function hideModule(module) {\n module.removeClass('_expanded');\n }\n}\n\nexport {init as init};\n"]}