/* * Name : main.js * Version : 1.0.0 * Product : prime05 * Author : 1px studio * Date : 2024.03.08 * Desc : - --------------------------------------------------- */ $(function(){if(null==document.getElementById("isIndex"))return;!function e(){function t(e){e.hide()}$(".px-layer-popup .btn-cookie-close").on("click",function(e){let i=$(this).closest(".px-layer-popup"),o=i.attr("id");e.preventDefault(),$.cookie(o,"1",{expires:1}),t(i)}),$(".px-layer-popup .btn-normal-close").on("click",function(e){let i=$(this).closest(".px-layer-popup");e.preventDefault(),t(i)})}();let e=$("#hero .progress-inner");!function t(){let i=new Swiper(".swiper.hero-swiper",{speed:1e3,loop:!0,slidesPerView:1,spaceBetween:0,autoplay:{delay:4500,disableOnInteraction:!1,pauseOnMouseEnter:!0},navigation:{nextEl:"#hero .hero-next",prevEl:"#hero .hero-prev"},effect:"fade",pagination:{el:"#hero .swiper-page",clickable:!0,bulletClass:"hero-bullet",bulletActiveClass:"hero-bullet-active"},on:{autoplayTimeLeft(t,i,o){$("#hero .progress-line").height();let l=(1-o)*100;l=l>100?100:l,e.height(l+"%")},slideChange:function(e){hero_stop=!1;let t=e.realIndex+1>9?e.realIndex+1:"0"+(e.realIndex+1);$("#hero .progress-num").text(t)}}}),o=$("#hero .hero-text-box[data-slide]"),l=o.last();function r(e){let t=e.realIndex,i=o.eq(t);gsap.to(l,{opacity:0,display:"none",duration:.001,onComplete(){gsap.fromTo(i,{opacity:0,display:"flex"},{opacity:1,duration:.001,ease:"power4.out",delay:.001}),gsap.fromTo(i.find("[up-transition]"),{y:"100px"},{y:"0%",duration:1,ease:"power4.out",delay:.3}),l=i}})}let a=$("#hero [up-transition]");$.each(a,function(){$(this).wrap("
")}),i.on("realIndexChange",function(e){r(e)}),r(i),$(".hero-more").on("mouseover",function(){i.autoplay.pause()}),$(".hero-more").on("mouseout",function(){i.autoplay.resume()})}(),!function e(){if(0==$("section.notice table.article-list").length)return;let t=RegExp(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/),i=$("section.notice table.article-list > tbody > tr"),o=[];i.each((e,i)=>{let l=$(i).find("a"),r=l.text().trim(),a=l.attr("href"),s=$(i).find("td").last().text().trim(),n=$(i).find("td").eq(2),c="";n.length>0&&t.test(n.text())&&(c=n.text().replaceAll("-",".")),o.push({date:c,title:r,desc:s,href:a})}),$("section.notice table.article-list").remove();let l="";o.forEach(e=>{l+='
',l+='',l+='
',l+="
"+e.title+"
",l+='
',l+='

'+e.desc+"

",l+='
',l+="

"+e.date+"

",l+="
"}),$("section.notice .notice-swiper .swiper-wrapper").html(l)}(),new Swiper(".notice .notice-swiper",{slidesPerView:1,loop:!0,effect:"fade",navigation:{nextEl:".notice .notice-next",prevEl:".notice .notice-prev"}}),$(".counter").counterUp({delay:10,time:1e3});let t=$("#video-popup"),i=$("#video-popup .video-wrapper"),o=i.children().data("video"),l,r;"youtube"==o&&(r=$("#ytplayer").attr("video-id"),window.YT.ready(function(){l=new YT.Player("ytplayer",{videoId:r,playerVars:{origin:location.origin,playlist:r}})})),$("#video-view").on("click",function(){gsap.fromTo(t,{opacity:0,display:"flex"},{opacity:1,duration:.5,ease:"power4.out",onComplete(){gsap.fromTo(i,{y:"-50%",opacity:0,display:"flex"},{y:"0%",opacity:1,duration:.5,ease:"power4.out",onComplete(){"vimeo"==o?new Vimeo.Player($("#video-popup iframe")).play():"youtube"==o?l.playVideo():"ftp"==o&&i[0].children[0].play()}})}})}),$("#video-popup .close-cover").on("click",function(){gsap.fromTo(i,{y:"0%"},{y:"-50%",opacity:0,display:"none",duration:.5,ease:"power4.out",onComplete(){if("vimeo"==o){let e=new Vimeo.Player($("#video-popup iframe"));e.pause(),e.setCurrentTime(0)}else if("youtube"==o)l.stopVideo();else if("ftp"==o){let t=i[0].children[0];t.pause(),t.currentTime=0}}}),gsap.fromTo(t,{opacity:1},{opacity:0,display:"none",duration:.5,ease:"power4.out"})});let a;a=$(".product"),$.each(a,function(e,t){var i="#"+t.id+" ";(function e(t){if(0==$(t+"table.article-list").length)return;let i=$(t+"table.article-list > tbody > tr"),o=[];i.each((e,t)=>{let i=$(t).find(".board_output_gallery_img > a"),l=$(t).find("tr:last-child > td"),r=i.attr("href"),a=i.find("img").attr("src"),s=l.find(".board_output_gallery_subject a"),n=l.find(".board_output_gallery_description"),c=s.text().trim(),d=n.text().trim();s.remove(),n.remove();let p=l.text().trim();o.push({category:p,title:c,desc:d,href:r,src:a})}),$(t+"table.article-list").remove();let l="";o.forEach(e=>{l+='
',l+='',l+='
',l+=''+e.title+'',l+='
',l+="View product
",l+='
',l+='
'+e.title+"
",l+="
"}),$(t+".product-swiper .swiper-wrapper").html(l)})(i),new Swiper(i+".product-swiper",{slidesPerView:1,spaceBetween:22,freeMode:!0,navigation:{nextEl:i+".swiper-next",prevEl:i+".swiper-prev"},breakpoints:{480:{slidesPerView:2},768:{slidesPerView:3},1100:{slidesPerView:3}}})}),$(".product .swiper-mobile-buttons button").on("click",function(e){$(this).hasClass("prev")?$(".product .swiper-prev").trigger("click"):$(".product .swiper-next").trigger("click")}),$(".client-box").marquee({speed:80,duplicated:!0,pauseOnHover:!0});let s;s=$(".blog"),$.each(s,function(e,t){!function e(t){if(0==$(t+"table.article-list").length)return;let i=$(t+"table.article-list > tbody > tr"),o=RegExp(/^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/),l=[];i.each((e,t)=>{let i=$(t).find("a"),r=i.attr("href"),a=i.find("img").attr("src"),s=$(t).find(".bd_out1").text().trim(),n=$(t).find("td").eq(3).text().trim();o.test(n)&&(n=n.substr(5,5).replace("-",".")),l.push({title:s,date:n,href:r,src:a})}),$(t+"table.article-list").remove();let r='
',a='
';l.forEach((e,t)=>{let i=0==t?" active":"";r+=''+e.title+'',a+='',a+=''+e.title+'',a+='
'+e.date+"
",a+='
'+e.title+"
",a+='
'}),r+="
",a+="
",$(t+".blog-box").html(r+a)}("#"+t.id+" ")}),$(".blog .blog-row").on("mouseover",function(e){$(".blog .blog-row").removeClass("active"),$(this).addClass("active");let t=$(this).index();$(".blog .blog-img img").removeClass("active"),$(".blog .blog-img img").eq(t).addClass("active")}),AOS.init({duration:800})});