// PhotoSwipe\30e2\30fc\30c0\30eb\56fa\5b9a\5316\30b9\30af\30ea\30d7\30c8  // assets/photoswipe-modal-fix.js \3068\3057\3066\65b0\898f\4f5c\6210  (function() {"use strict"; let isVideoModalOpen = false; let savedScrollPosition = 0; // PhotoSwipe\306e\521d\671f\5316\3092\5b8c\5168\306b\4e0a\66f8\304d  document.addEventListener("DOMContentLoaded",function() {// \52d5\753b\30dc\30bf\30f3\306e\30af\30ea\30c3\30af\30a4\30d9\30f3\30c8\3092\4e0a\66f8\304d  document.addEventListener("click",function(e) {const videoPlayButton = e.target.closest(".image__video__play"); if (videoPlayButton) {e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); openFixedVideoModal(videoPlayButton); return false;}},true); // capture \30d5\30a7\30fc\30ba\3067\51e6\7406}); function openFixedVideoModal(element) {const videoData = element.getAttribute("data-video-play"); if (!videoData) return; // \30b9\30af\30ed\30fc\30eb\4f4d\7f6e\3092\4fdd\5b58\3057\3066\753b\9762\3092\56fa\5b9a  savedScrollPosition = window.pageYOffset || document.documentElement.scrollTop; document.body.style.position = "fixed"; document.body.style.top = `-${savedScrollPosition}px`; document.body.style.width = "100%"; document.body.style.overflow = "hidden"; document.documentElement.style.overflow = "hidden"; isVideoModalOpen = true; // PhotoSwipe\3092\521d\671f\5316\ff08\8a2d\5b9a\3092\5b8c\5168\5236\5fa1\ff09  const pswpElement = document.querySelector(".pswp"); if (!pswpElement) return; const items = [{html: videoData,title: ""}]; const options = {index: 0,bgOpacity: .95,showHideOpacity: false,loop: false,pinchToClose: false,closeOnScroll: false,closeOnVerticalDrag: false,mouseUsed: false,escKey: true,arrowKeys: false,history: false,focus: false,mainClass: "pswp--video-modal",getThumbBoundsFn: function() {return {x: 0,y: 0,w: 0};}}; const gallery = new PhotoSwipe(pswpElement,PhotoSwipeUI_Default,items,options); // PhotoSwipe\306e\30a4\30d9\30f3\30c8\3092\5b8c\5168\306b\5236\5fa1  gallery.listen("initialZoomIn",function() {preventAllScrolling(); setupVideoModal();}); gallery.listen("afterChange",function() {preventAllScrolling(); setupVideoModal();}); gallery.listen("close",function() {closeVideoModal();}); gallery.listen("destroy",function() {closeVideoModal();}); // PhotoSwipe\306e\5185\90e8\51e6\7406\3092\4e0a\66f8\304d  const originalUpdateScrollOffset = gallery.updateScrollOffset; gallery.updateScrollOffset = function() {// \30b9\30af\30ed\30fc\30eb\30aa\30d5\30bb\30c3\30c8\306e\66f4\65b0\3092\7121\52b9\5316  return;}; const originalClose = gallery.close; gallery.close = function() {if (arguments.length === 0 || arguments[0] !== "user-action") {// \81ea\52d5\7684\306a\9589\3058\308b\51e6\7406\3092\7121\52b9\5316  return;} originalClose.call(this);}; gallery.init();} function setupVideoModal() {setTimeout(() => {const modalVideos = document.querySelectorAll(".pswp video"); modalVideos.forEach(video => {// \30eb\30fc\30d7\3092\7121\52b9\5316  video.loop = false; video.removeAttribute("loop"); // \52d5\753b\306e\5f37\5236\7d99\7d9a\518d\751f  const keepVideoPlaying = () => {if (isVideoModalOpen && video.paused && !video.ended) {video.play().catch(() => {});}}; video.addEventListener("pause",keepVideoPlaying); video.addEventListener("suspend",keepVideoPlaying); video.addEventListener("waiting",keepVideoPlaying); // Intersection Observer \3092\7121\52b9\5316  if (video.observer) {video.observer.disconnect();} // \30af\30ea\30fc\30f3\30a2\30c3\30d7\7528\306b\4fdd\5b58  video._keepPlaying = keepVideoPlaying;}); // PhotoSwipe\30b3\30f3\30c6\30ca\306b\30af\30e9\30b9\8ffd\52a0  const pswp = document.querySelector(".pswp"); if (pswp) {pswp.classList.add("pswp--fixed-modal");}},100);} function preventAllScrolling() {// \3059\3079\3066\306e\30b9\30af\30ed\30fc\30eb\30a4\30d9\30f3\30c8\3092\963b\6b62  const preventEvent = (e) => {if (isVideoModalOpen) {e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); return false;}}; // \30a4\30d9\30f3\30c8\30ea\30b9\30ca\30fc\3092\8ffd\52a0\ff08\65e2\5b58\306e\3082\306e\304c\3042\308c\3070\524a\9664\3057\3066\304b\3089\8ffd\52a0\ff09  document.removeEventListener("wheel",preventEvent,true); document.removeEventListener("touchmove",preventEvent,true); document.removeEventListener("scroll",preventEvent,true); document.removeEventListener("touchstart",preventEvent,true); document.removeEventListener("touchend",preventEvent,true); document.addEventListener("wheel",preventEvent,{passive: false,capture: true}); document.addEventListener("touchmove",preventEvent,{passive: false,capture: true}); document.addEventListener("scroll",preventEvent,{passive: false,capture: true}); document.addEventListener("touchstart",preventEvent,{passive: false,capture: true}); document.addEventListener("touchend",preventEvent,{passive: false,capture: true}); // \30ad\30fc\30dc\30fc\30c9\30b9\30af\30ed\30fc\30eb\3082\9632\6b62  document.addEventListener("keydown",(e) => {if (isVideoModalOpen) {const scrollKeys = [32,33,34,35,36,37,38,39,40]; // Space,Page keys,Arrow keys if (scrollKeys.includes(e.keyCode)) {e.preventDefault(); e.stopPropagation(); return false;}}},{passive: false,capture: true});} function closeVideoModal() {isVideoModalOpen = false; // \52d5\753b\3092\505c\6b62  const modalVideos = document.querySelectorAll(".pswp video"); modalVideos.forEach(video => {video.pause(); if (video._keepPlaying) {video.removeEventListener("pause",video._keepPlaying); video.removeEventListener("suspend",video._keepPlaying); video.removeEventListener("waiting",video._keepPlaying); delete video._keepPlaying;}}); // \30b9\30af\30ed\30fc\30eb\4f4d\7f6e\3092\5fa9\5143  document.body.style.position = ""; document.body.style.top = ""; document.body.style.width = ""; document.body.style.overflow = ""; document.documentElement.style.overflow = ""; window.scrollTo(0,savedScrollPosition); // PhotoSwipe\30b3\30f3\30c6\30ca\304b\3089\30af\30e9\30b9\524a\9664  const pswp = document.querySelector(".pswp"); if (pswp) {pswp.classList.remove("pswp--fixed-modal");}} // ESC\30ad\30fc\3067\9589\3058\308b\51e6\7406  document.addEventListener("keydown",function(e) {if (e.key === "Escape" && isVideoModalOpen) {const gallery = window.pswp; if (gallery) {gallery.close("user-action");}}}); // PhotoSwipe\80cc\666f\30af\30ea\30c3\30af\3067\9589\3058\308b\51e6\7406\3092\4e0a\66f8\304d  document.addEventListener("click",function(e) {if (isVideoModalOpen && e.target.classList.contains("pswp__bg")) {const gallery = window.pswp; if (gallery) {gallery.close("user-action");}}});})();{}
/*# sourceMappingURL=/cdn/shop/t/7/assets/video-custom.css.map */
