function isTouchDevice(){try{return document.createEvent("TouchEvent"),!0}catch(n){return!1}}function getParameterByName(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t===null?"":decodeURIComponent(t[1].replace(/\+/g," "))}function isTouchDevice(){try{return document.createEvent("TouchEvent"),!0}catch(n){return!1}}$(document).ready(function(){var n=$(".slider-nav");n.on("init reInit afterChange",function(n,t){var i=t.slideCount;i<=1&&$(".hk-conditional-priview").css("visibility","hidden");i>=2&&$(".hk-conditional-priview").css("visibility","visible")});$(".logoutbtn").on("click",function(n){return n.preventDefault(),gigya.accounts.logout({callback:console.log}),!1})});$(document).ready(function(){function n(){$(".product-carousel iframe")&&$(".product-carousel iframe").each(function(){$(this).attr("src",$(this).attr("src")+"&version=3&enablejsapi=1");$(this).css("width",$(".slick-list").width()+"px");$(this).css("height",$(".slick-list").height()-20+"px")})}function t(){$(".slick-slide.slick-current.slick-active.slick-center img").attr("data-url")?($(".product-carousel iframe").each(function(){src_attr=$(this).attr("src").replace("autoplay=0","autoplay=1");$(this).attr("src",src_attr)}),$(".slider-zoom a.zoom").attr("href",$(".slick-slide.slick-current.slick-active.slick-center img").attr("data-url"))):$(".slider-zoom a.zoom").attr("href",$(".slick-slide.slick-current.slick-active.slick-center img").attr("src"))}top.location.pathname=="/zh-hk/products/diaper-pants/diamond-pants"&&($("h2.colored").css("margin-bottom: 2px;"),$("<h2 style='color: #d92032;font-size: 26px;font-style: normal;font-weight: 500;'>學習褲模擬吸濕扭動1000次後<\/h2>").insertAfter("h2.colored:first"),$('img[src="/-/media/images/hongkong-huggies/all-products/products-hongkong/diamond_pants_0.png?h=400&w=400&la=zh-HK&hash=287FE13AB4969A5A7D93B29EEF2B921B840AEECD"]').css("width","auto"));$(".slider-navproduct-carousel .slider-for").slick({slidesToShow:1,slidesToScroll:1,arrows:!1,fade:!0,asNavFor:".product-carousel .slider-nav",autoplay:!1,autoplaySpeed:3e3});$(".product-carousel .slider-nav").slick({slidesToShow:1,slidesToScroll:1,asNavFor:".product-carousel .slider-for",dots:!1,centerMode:!0,focusOnSelect:!0,variableWidth:!0});$(".slider-for").on("beforeChange",function(n,t,i,r){console.log(i,r);$(".slider-for iframe").each(function(){$(this)[0].contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*")})});$(".slider-for").on("afterChange",function(){$(".slider-zoom a.zoom").attr("href",$(".slider-for .slick-current img").attr("src"))});$(".slider-zoom a.zoom").attr("href",$(".slider-for .slick-track > div:first-child").attr("data-zoom"));t();n();$(".slider-for").on("afterChange",function(){t();$(".product-carousel iframe").each(function(){isTouchDevice()||$(this)[0].contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*")})});$(window).on("resize",function(){isTouchDevice()||n()});if($(".slider-zoom a.zoom").click(function(){$(".product-carousel iframe").each(function(){isTouchDevice()||$(this)[0].contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}',"*")})}),top.location.pathname=="/edmcontactme"){var i=getParameterByName("cont");i=="call"?($(".CallMe").css("display","block"),$(".DontCallMe").css("display","none")):i=="dont"&&($(".CallMe").css("display","none"),$(".DontCallMe").css("display","block"))}});var srcImage,video,player;$(document).ready(function(){function r(){if(isTouchDevice()){$(".yt-video-pop .video-cover-for-1").off("click");$(".yt-video-pop .video-cover-for-1").on("click",function(){var n=$(this);$(document).on("opened.fndtn.reveal","[data-reveal]",function(){popurl=n.attr("data-video")+"?rel=0&autoplay=1&enablejsapi";$("#popIframeMB").attr("src",popurl);f()})})}else{$(".yt-video .video-cover-for-1").off("click");$(".yt-video .video-cover-for-1").on("click",function(){console.log(player);player&&(player.seekTo(player.getDuration()),player.stopVideo());var n=$(this);setTimeout(function(){var t=n.height();srcImage=n.parent().html();video='<iframe id="popIframe" src="'+n.attr("data-video")+'?rel=0&enablejsapi=1&autoplay=1"frameborder="0" height='+t+' style="width:100%;border:none;" allowfullscreen data-img'+n.attr("src")+"><\/iframe>";n.hide();n.parent().append(video);u()},500)})}}function u(){player=new YT.Player("popIframe",{events:{onStateChange:i}})}function f(){player=new YT.Player("popIframeMB",{events:{onStateChange:i}})}function e(n){n==-1?console.log("unstarted"):n==0?($("#popIframe").parent().find("img").show(),$("#popIframe").remove(),player=null):n==1?console.log("playing"):n==2?console.log("paused"):n==3?console.log("buffering"):n==5&&console.log("video")}function i(n){e(n.data)}var n,t;r();n=document.createElement("script");n.id="iframe-demo";n.src="https://www.youtube.com/iframe_api";t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)})