2023-10-06 21:29:45 +00:00
|
|
|
requirejs.config({baseUrl:"/assets/js",paths:{queue:"lib/queue",jquery:"lib/jquery",d3:"lib/d3",howler:"lib/howler-2.2.4.min",underscore:"lib/underscore",scrollMonitor:"lib/scrollMonitor",remodal:"lib/remodal",makeVideoPlayableInline:"lib/inline-video",zoomer:"components/zoomer",social:"components/social"},shim:{"lib/jquery.jscroll":["jquery"]}}),require(["jquery","underscore","queue","zoomer","scrollMonitor","makeVideoPlayableInline","remodal","social","howler"],function(l,e,o,a,u,n,t,i,{Howl:s}){var c=document.querySelectorAll(".ambient-audio-controller"),c=(l(c),document.querySelectorAll(".panel-audio")),r=(l(c),document.querySelectorAll(".video-cinemagraph")),d=l(r);document.addEventListener("DOMContentLoaded",function(e){console.log("isMobile, isLegacyMobile, isModernMobile",m(),m()&&!p(),p())}),l(".video-cinemagraph-cover").each(function(e,o){n(this)}),l(r).each(function(e,o){var a;m()?(o.setAttribute("autoplay",""),n(this)):((a=u.create(o)).enterViewport(function(e){a.watchItem.play()}),a.exitViewport(function(e){a.watchItem.paused||a.watchItem.pause()}))});{var f=void 0;f=f||{top:0,bottom:0};let r=[];l(c).each(function(e,o){var a=l(o).find(".ambient-audio-controller"),n=a.find(".ambient-audio-controller__state");const t=new s({src:[a.attr("data-audio-ogg"),a.attr("data-audio-mp3")],loop:!1}),i=(r.push(t),()=>{t.fade(t.volume(),0,1e3),t.once("fade",()=>t.pause())});m()?a.on("click",function(){t.playing()?(n.removeClass("on off").addClass("off"),i()):(n.removeClass("on off").addClass("on"),t.fade(t.volume(),.5,1e3),t.play())}):((o=u.create(o,f)).fullyEnterViewport(function(){a.addClass("pulse"),setTimeout(function(){a.removeClass("pulse")},1e3),.5!==t.volume()&&t.fade(0,.5,1e3),t.play()}),o.exitViewport(function(){i()}),a.on("click",function(){var e,o;e=t,o=n,e.playing()?e._muted?(e.mute(!1),e.fade(e.volume(),.5,400),o.removeClass("on off").addClass("on")):(e.fade(e.volume(),0,400),e.once("fade",()=>e.mute(!0)),o.removeClass("on off").addClass("off")):e.play()}))})}function m(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry/.test(navigator.userAgent)}function p(){return navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS [8|9|10]_\d/i)&&-1<navigator.userAgent.indexOf("Safari")&&-1==navigator.userAgent.indexOf("CriOS")||-1<navigator.userAgent.indexOf("Twitter")}m()&&d.on("touchstart",function(e){var o=l(this)[0];o.paused&&o.play()}),a()});
|