<div id="photoModal" class="photo-modal" style="display:none;">
  <div class="photo-modal-content">
    <span class="photo-modal-close">&times;</span>
    <div id="photoLoader" class="photo-loader"><div class="photo-spinner"></div></div>
    <span id="prevPhoto" class="photo-arrow left-arrow">&#10094;</span>
    <img id="photoMain" class="photo-main" src="" alt="gallery">
    <span id="nextPhoto" class="photo-arrow right-arrow">&#10095;</span>
    <div id="photoThumbs" class="photo-thumbs"></div>
  </div>
</div>

<style>
body .is-layout-flow > * + *,body .is-layout-constrained > * + * {margin-block-start: 0 !important;}
body{--wp--custom--spacing--outer: min(3vw, 90px) !important;}
body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {max-width: 1000px !important;}
.wp-site-blocks > * + * {margin-block-start: 0 !important;}
footer{display: inline-block;}
footer .has-text-align-right{display:none}
.wpgmp_pagination a{color: #29b6f6 !important;}
.photo-modal { display:none; position:fixed; z-index:2147483647 !important; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,0.95); align-items:center; justify-content:center; }
.photo-modal-content { position:relative; width:90%; max-width:1100px; background:#000; padding:10px; border-radius:8px; }
.photo-main { width:100%; max-height:75vh; object-fit:contain; display:block; margin:0 auto; background:#111; }
.photo-modal-content img { max-width: 100% !important; }
.photo-thumbs { display:flex; gap:8px; overflow-x:auto; padding:10px 0; min-height:80px; justify-content:center; }
.photo-thumbs img { height:60px; cursor:pointer; opacity:0.5; border:2px solid transparent; transition: 0.3s; }
.photo-thumbs img.active { opacity:1; border-color:#fff; }
.photo-arrow { position:absolute; top:50%; color:#fff; font-size:50px; cursor:pointer; padding:20px; z-index:100; transform:translateY(-50%); user-select:none; }
.left-arrow { left:0; } .right-arrow { right:0; }
.photo-modal-close { position:absolute; top:5px; right:15px; color:#fff; font-size:40px; cursor:pointer; z-index:110; }
.photo-loader { position:absolute; inset:0; display:none; align-items:center; justify-content:center; background:rgba(0,0,0,0.8); z-index:105; }
.photo-loader.active { display:flex; }
@media only screen and (max-width: 768px) {
    .wpgmp_pagination { display: flex; flex-direction: column; justify-content: center; align-items: stretch; }
}
@keyframes photoSpin { to { transform:rotate(360deg); } }
.photo-spinner { width:45px; height:45px; border:4px solid rgba(255,255,255,0.3); border-top-color:#fff; border-radius:50%; animation:photoSpin 1s linear infinite; }
</style>

<script>
(function($) {
    window.openPhotoGallery = function(baseUrl) {
        const modal = $("#photoModal"), mainImg = $("#photoMain"), thumbs = $("#photoThumbs"), loader = $("#photoLoader");
        modal.css("display", "flex").hide().fadeIn(200);
        loader.addClass("active");
        thumbs.empty(); mainImg.attr("src", "");
        let gState = { images: [], index: 0 };
        const promises = [];
        for (let i = 1; i <= 10; i++) {
            const src = baseUrl + "/" + i + ".jpg";
            promises.push(new Promise(res => {
                const img = new Image();
                img.onload = () => res({src, i});
                img.onerror = () => res(null);
                img.src = src;
            }));
        }
        Promise.all(promises).then(results => {
            gState.images = results.filter(r => r !== null).sort((a,b) => a.i - b.i);
            if (gState.images.length === 0) {
                mainImg.attr("alt", "No images found.");
                loader.removeClass("active"); return;
            }
            gState.images.forEach((imgObj, idx) => {
                $("<img style='height:60px;margin:5px;cursor:pointer;'>").attr("src", imgObj.src)
                    .on("click", () => showIdx(idx)).appendTo(thumbs);
            });
            function showIdx(idx) {
                gState.index = idx;
                mainImg.attr("src", gState.images[idx].src);
                thumbs.find("img").removeClass("active").eq(idx).addClass("active");
            }
            showIdx(0); loader.removeClass("active");
            $("#prevPhoto").off("click").on("click", (e) => { e.stopPropagation(); if (gState.index > 0) showIdx(gState.index - 1); });
            $("#nextPhoto").off("click").on("click", (e) => { e.stopPropagation(); if (gState.index < gState.images.length - 1) showIdx(gState.index + 1); });
        });
    };

    $(document).ready(function() {
        function fixUrl(url) {
            if (!url) return "";
            var origin = window.location.origin;
            if (window.location.hostname === "yifanaparis.com") {
                // 外网时：把原本带 /wordpress 的资源地址替换为当前纯域名 origin，干净且不带子目录
                return url.replace(/^https?:\/\/192\.168\.0\.119\/wordpress/g, origin)
                          .replace(/^https?:\/\/192\.168\.0\.119/g, origin)
                          .replace("http://", "https://");
            } else {
                return url.replace(/^https?:\/\/192\.168\.0\.119/g, origin);
            }
        }
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(m) {
                m.addedNodes.forEach(function(node) {
                    if (node.nodeType === 1) {
                        var nodeObj = $(node);
                        if (nodeObj.hasClass("leaflet-popup") || nodeObj.find(".wpgmp_infowindow").length > 0 || nodeObj.find("img").length > 0) {
                            nodeObj.find("img").addBack("img").each(function() {
                                var s = $(this).attr("src");
                                if (s && (s.includes("yifanaparis.com") || s.includes("yifanaparis.com\/wordpress"))) {
                                    $(this).attr("src", fixUrl(s));
                                }
                            });
                        }
                    }
                });
            });
        });
        observer.observe(document.body, { childList: true, subtree: true });
        
        $(document).on("click", function(e) {
            var target = $(e.target);
            if (target.is("img") && (target.hasClass("wpgmp_marker_image") || target.closest(".wpgmp_infowindow").length > 0)) {
                var fixedSrc = fixUrl(target.attr("src"));
                window.openPhotoGallery(fixedSrc.substring(0, fixedSrc.lastIndexOf("/")));
                e.preventDefault(); e.stopPropagation();
            }
            if (target.hasClass("photo-modal-close") || target.attr("id") === "photoModal") $("#photoModal").fadeOut(200);
        });
    });
})(jQuery);
</script><div id="photoModal" class="photo-modal" style="display:none;">
  <div class="photo-modal-content">
    <span class="photo-modal-close">×</span>
    <div id="photoLoader" class="photo-loader"><div class="photo-spinner"></div></div>
    <span id="prevPhoto" class="photo-arrow left-arrow">❮</span>
    <img id="photoMain" class="photo-main" src="" alt="gallery">
    <span id="nextPhoto" class="photo-arrow right-arrow">❯</span>
    <div id="photoThumbs" class="photo-thumbs"></div>
  </div>
</div>{"id":17,"date":"2025-08-01T11:51:21","date_gmt":"2025-08-01T11:51:21","guid":{"rendered":"https:\/\/yifanaparis.com\/wordpress\/?page_id=17"},"modified":"2026-04-17T15:33:24","modified_gmt":"2026-04-17T15:33:24","slug":"home","status":"publish","type":"page","link":"https:\/\/yifanaparis.com\/","title":{"rendered":""},"content":{"rendered":"<p>[my_frosted_photo_wall]<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-large-header","meta":[],"_links":{"self":[{"href":"https:\/\/yifanaparis.com\/index.php?rest_route=\/wp\/v2\/pages\/17"}],"collection":[{"href":"https:\/\/yifanaparis.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/yifanaparis.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/yifanaparis.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yifanaparis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":15,"href":"https:\/\/yifanaparis.com\/index.php?rest_route=\/wp\/v2\/pages\/17\/revisions"}],"predecessor-version":[{"id":89,"href":"https:\/\/yifanaparis.com\/index.php?rest_route=\/wp\/v2\/pages\/17\/revisions\/89"}],"wp:attachment":[{"href":"https:\/\/yifanaparis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}