{"version":3,"sources":["js-partials/test.js","main.js"],"names":["document","addEventListener","getElementById","gsap","to","duration","x","querySelectorAll","currentIndex","showSlide","index","forEach","slide","i","classList","remove","add","slides","setInterval","length","currentPart","sliderWrapper","nextSlide","querySelector","parse","getAttribute","postCount","projectData","target","current","offsetWidth","window","innerWidth","previousPart","maxScroll","postWidth","navigator","userAgent","match","updateSlideVideos","playPauseButton","imageWrapper","isMobileDevice","video","paused","play","textContent","display","pause","currentTime","style","touchSensitivity","e","touchStartX","Math","touches","clientX","min","touchDelta","max","touchEndX","horizontalLine","fadeLines","unfadeLines","update","moveRatio","markerMove","updateActiveSliderNumber","markerMaxMove","set","newPart","orientation","num","partWidth","title","activeSlide","projectYearSlide","projectTitleSlide","verticalLine","left","event","concat","top","clientY","element","loader","setTimeout"],"mappings":"AACCA,SAASC,iBAAiB,mBAAoB,WAE7BD,SAASE,eAAe,MAAM,EAG3CC,KAAKC,GAAG,QAAS,CAAEC,SAAU,EAAGC,EAAG,GAAI,CAAC,CAC5C,CAAC,EAPFN,SAAAC,iBAAA,mBAAA,WACCD,IAASC,EAAAA,SAAiBC,eAAA,aAAoB,EAAWK,iBAAA,eAAA,EACrDC,EAAA,EAIAL,SAAQM,EAASC,GAAEL,EAAWM,QAAA,SAAAC,EAAAC,GAAKD,EAAAE,UAAAC,OAAA,QAAA,EAAMF,IAAAH,GAC3CE,EAAAE,UAAAE,IAAA,QAAA,CCOK,CAAC,CAbT,CAQQC,EAAON,CAAQ,EAenBO,YArBA,WAEAT,EADID,GAAgBA,EAAA,GAAAS,EAAAE,MACpB,CACA,EAIwBJ,GAAO,CAenC,CAAC,EAGDf,SAdUC,iBAAA,mBAAA,WAIFO,IAAAA,EAAY,EACZC,EAAUD,EAeVY,EAAc,EATpBC,GADcC,SAAWC,cAAK,SAAA,EAC9BvB,SAAAuB,cAAA,iBAAA,GAGOtB,EAAAA,KAAiBuB,MAAAH,EAAoBI,aAAW,eAAA,CAAA,EAErDC,EAAAC,EAAAR,OACI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C,EAAsBxB,YAAQwB,EAAOA,EAAA,GAAAI,MACrCC,EAAY7B,YAAWnB,EAAa2C,EAAI5C,GAAAA,KAGlCkD,IAAgBxD,IACtByD,EAAkB/B,CAAcnB,EAChCiD,EAAiB9B,GAmEjBlB,sBAAqBA,CAAO,CAC5BA,EAqGR,CAjBA,CAAC,EAED5B,SAkBAA,iBAASC,mBAA8B,WAhBvC,IAkBE6E,EAAmBC,SAAIxD,cAAYiC,wBAAW,EAC9CK,EAAeX,SAAS3B,cAAMyD,sBAAiB,EAfjD,SAkBAlB,IACA9D,EAASO,UAAgBS,IAAC,OAAA,EAjBxB8D,EAkBQ7E,UAAAA,IAAiB,OAAA,CAjB3B,CAuBA8B,SAAO9B,IACH4D,EAAe7D,UAASE,OAAAA,OAAe,EAnBzC4E,EAAahE,UAAUC,OAAO,OAAO,CACvC,CAGAf,SAoBIC,iBAAA,YAAA,SAAA+E,GAlBFF,EAoBa5B,MAAMH,KAAO,GAAAkC,OAAGD,EAAMxB,QAAA,IAAA,EACjCK,EAAUX,MAAAgC,IAAA,GAAAD,OAAAD,EAAAG,QAAA,IAAA,CACd,CAAC,EAjBDnF,SAASO,iBAAiB,eAAe,EAAEI,QAAQ,SAACyE,GAClDA,EAAQnF,iBAAiB,aAAc6D,CAAS,EAChDsB,EAAQnF,iBAAiB,aAAc8D,CAAW,CACpD,CAAC,CACD,CAAC,EAGDhC,OAAO9B,iBAAiB,OAAQ,WAC5B,IAAMoF,EAASrF,SAASE,eAAe,QAAQ,EAM/CoF,WAAW,WACPD,EAAOnC,MAAMH,QAAU,MAC3B,EAAG,GAAI,CACX,CAAC","file":"main.js","sourcesContent":["//console.log('1724252387');\n document.addEventListener('DOMContentLoaded', function() {\n //console.log('DOM loaded');\n const test = document.getElementById('test');\n // use closest to find the closest parent element from the div parent element in future\n //console.log(gsap);\n gsap.to('#test', { duration: 1, x: 100 });\n });","\n// slider home page\ndocument.addEventListener('DOMContentLoaded', function() {\n const slides = document.getElementById('home-slider').querySelectorAll('.project-item');\n let currentIndex = 0;\n // console.log(slides)\n // console.log(currentIndex)\n\n function showSlide(index) {\n slides.forEach((slide, i) => {\n slide.classList.remove('active');\n if (i === index) {\n slide.classList.add('active');\n }\n });\n }\n\n function nextSlide() {\n currentIndex = (currentIndex + 1) % slides.length;\n showSlide(currentIndex);\n }\n\n // Initialize the slider\n showSlide(currentIndex);\n setInterval(nextSlide, 2000); \n});\n\n\ndocument.addEventListener('DOMContentLoaded', function() {\n \n // Slider logic variables\n let target = 0;\n let current = 0;\n let ease = 0.075;\n let currentPart = 1;\n let previousPart = null;\n\n const slider = document.querySelector('.slider');\n const sliderWrapper = document.querySelector('.slider-wrapper');\n const projectData = JSON.parse(sliderWrapper.getAttribute('data-projects'));\n const postCount = projectData.length;\n const activeSlide = document.querySelector('.active-slide');\n const markerWrapper = document.querySelector('.marker-wrapper');\n\n let maxScroll = sliderWrapper.offsetWidth - window.innerWidth;\n const postWidth = sliderWrapper.offsetWidth / postCount;\n maxScroll = postWidth * postCount - window.innerWidth;\n\n function lerp(start, end, factor) {\n return start + (end - start) * factor;\n }\n\n function isMobileDevice() {\n return (typeof window.orientation !== \"undefined\") || navigator.userAgent.match(/Android|iPhone|iPad|iPod|IEMobile|BlackBerry|Opera Mini/i);\n }\n\n function updateActiveSliderNumber(markerMove, markerMaxMove) {\n const partWidth = markerMaxMove / postCount;\n const num = window.innerWidth <= 670 ? 100 : 220;\n let newPart = Math.round((markerMove - num) / partWidth) + 1;\n newPart = Math.min(postCount, newPart);\n newPart = newPart === 0 ? 1 : newPart;\n activeSlide.textContent = `${newPart}/${postCount}`;\n\n const projectTitleSlide = document.querySelector('.project-title-slide');\n const projectYearSlide = document.querySelector('.project-year-slide');\n projectTitleSlide.textContent = projectData[newPart - 1].title;\n projectYearSlide.textContent = projectData[newPart - 1].year;\n\n if (newPart !== currentPart) {\n updateSlideVideos(newPart);\n currentPart = newPart;\n }\n }\n\n function updateSlideVideos(currentPart) {\n const slides = document.querySelectorAll('.slide');\n slides.forEach((slide, index) => {\n const video = slide.querySelector('.hover-video');\n const playPauseButton = slide.querySelector('.play-pause-button');\n const imageWrapper = slide.querySelector('.image-wrapper');\n\n if (video) {\n if (index === currentPart - 1) {\n // This is the current slide\n if (isMobileDevice()) {\n if (video.paused) {\n video.play();\n if (playPauseButton) playPauseButton.textContent = 'Pause';\n if (imageWrapper) imageWrapper.style.display = 'none'; // Hide the image\n }\n }\n // For desktop, videos play/pause on hover\n } else {\n // Not the current slide, pause the video\n if (!video.paused) {\n video.pause();\n video.currentTime = 0;\n if (playPauseButton) playPauseButton.textContent = 'Play';\n }\n if (imageWrapper) imageWrapper.style.display = ''; // Show the image\n }\n }\n });\n }\n\n function update() {\n current = lerp(current, target, ease);\n\n gsap.set(\".slider-wrapper\", {\n x: -current,\n });\n\n let moveRatio = current / maxScroll;\n\n let markerMaxMove = window.innerWidth - markerWrapper.offsetWidth - 170;\n\n let markerMove = 70 + moveRatio * markerMaxMove;\n\n gsap.set('.marker-wrapper', {\n x: markerMove,\n });\n\n updateActiveSliderNumber(markerMove, markerMaxMove);\n\n requestAnimationFrame(update);\n }\n\n window.addEventListener('resize', function() {\n maxScroll = sliderWrapper.offsetWidth - window.innerWidth;\n });\n\n window.addEventListener('wheel', function(e) {\n target += e.deltaY;\n target = Math.max(0, target);\n target = Math.min(maxScroll, target);\n });\n\n // Touch event handling for mobile devices\n let touchStartX = 0;\n let touchEndX = 0;\n const touchSensitivity = window.innerWidth <= 768 ? 2 : 0.5;\n\n sliderWrapper.addEventListener('touchstart', function(e) {\n touchStartX = e.touches[0].clientX;\n });\n\n sliderWrapper.addEventListener('touchmove', function(e) {\n touchEndX = e.touches[0].clientX;\n let touchDelta = (touchStartX - touchEndX) * touchSensitivity;\n target += touchDelta;\n target = Math.max(0, target);\n target = Math.min(maxScroll, target);\n touchStartX = touchEndX;\n });\n\n // Set up event listeners for play/pause buttons and image visibility\n const slides = document.querySelectorAll('.slide');\n slides.forEach((slide) => {\n\n const video = slide.querySelector('.hover-video');\n const playPauseButton = slide.querySelector('.play-pause-button');\n const imageWrapper = slide.querySelector('.image-wrapper');\n\n if (video) {\n //console.log(video)\n /*\n if (playPauseButton) {\n playPauseButton.addEventListener('click', function() {\n if (video.paused) {\n video.play();\n playPauseButton.textContent = 'Pause';\n } else {\n video.pause();\n playPauseButton.textContent = 'Play';\n }\n });\n }\n \n\n // Update button text and image visibility based on video state\n video.addEventListener('play', function() {\n if (playPauseButton) playPauseButton.textContent = 'Pause';\n if (imageWrapper) imageWrapper.style.display = 'none'; // Hide the image\n });\n\n video.addEventListener('pause', function() {\n if (playPauseButton) playPauseButton.textContent = 'Play';\n if (imageWrapper) imageWrapper.style.display = ''; // Show the image\n });\n\n video.addEventListener('ended', function() {\n video.currentTime = 0;\n if (playPauseButton) playPauseButton.textContent = 'Play';\n if (imageWrapper) imageWrapper.style.display = ''; // Show the image\n });\n */\n\n if (!isMobileDevice()) {\n // For desktop devices, add hover events\n slide.addEventListener('mouseenter', function() {\n video.play();\n if (imageWrapper) imageWrapper.style.display = 'none'; // Hide the image\n });\n\n slide.addEventListener('mouseleave', function() {\n video.pause();\n video.currentTime = 0;\n if (imageWrapper) imageWrapper.style.display = ''; // Show the image\n });\n }\n }\n });\n\n // Call updateSlideVideos to handle initial state\n updateSlideVideos(currentPart);\n\n // Start the update loop\n update();\n});\n\ndocument.addEventListener('DOMContentLoaded', function() {\n// Select the lines\nconst horizontalLine = document.querySelector(\".mouse-line.horizontal\");\nconst verticalLine = document.querySelector(\".mouse-line.vertical\");\n\n// Function to add the \"faded\" class to both lines\nfunction fadeLines() {\n horizontalLine.classList.add(\"faded\");\n verticalLine.classList.add(\"faded\");\n}\n\n// Function to remove the \"faded\" class from both lines\nfunction unfadeLines() {\n horizontalLine.classList.remove(\"faded\");\n verticalLine.classList.remove(\"faded\");\n}\n\n// Mousemove event to update the line positions\ndocument.addEventListener(\"mousemove\", function(event) {\n // Update the position of the vertical and horizontal lines\n verticalLine.style.left = `${event.clientX}px`;\n horizontalLine.style.top = `${event.clientY}px`;\n});\n\n// Add event listeners to handle mouse over specific elements\ndocument.querySelectorAll(\".hover-target\").forEach((element) => {\n element.addEventListener(\"mouseenter\", fadeLines); // Fade the lines on hover\n element.addEventListener(\"mouseleave\", unfadeLines); // Unfade the lines when leaving\n});\n});\n \n\nwindow.addEventListener('load', function() {\n const loader = document.getElementById('loader');\n \n // Set opacity to 0 to fade out\n //loader.style.opacity = '0';\n \n // After the transition, set display to 'none' to remove the loader from the document flow\n setTimeout(function() {\n loader.style.display = 'none';\n }, 1000); // Matches the duration of the CSS transition (0.5s)\n});"]}