<?php
/**

    _    _  __    _    ____  _   _ ___ 
   / \  | |/ /   / \  / ___|| | | |_ _|
  / _ \ | ' /   / _ \ \___ \| |_| || | 
 / ___ \| . \  / ___ \ ___) |  _  || | 
/_/   \_\_|\_\/_/   \_\____/|_| |_|___|

 * [Romanticism]
 * footer.php 页脚文件
 * @version 2.1 - 250202
**/
?>

<div class="mdui-shadow-0 mdui-text-center mdui-card toup">
<br>
      <br>
      <span class="title">
        &copy;<?php echo date("Y"); ?> <?php $this->options->title(); ?>
        <br>
        <?php if($this->options->AKAROMfootericp):?>
            <?php echo'<br>';
                  echo $this->options->AKAROMfootericp; ?>
        </span><br>
          <?php else: ?>
            </span><br>
            <a href="https://beian.miit.gov.cn/" target="_blank" class="chameleon underline">渝ICP备2025062723号-1</a><br>
        <?php endif;?>
         <br>
         <!-- 已经弄得很不显眼了，请不要删除以下信息 -->
      <small style="opacity: .5;">Theme <b><a class="chameleon underline" onclick="window.location.href='https://imakashi.eu.org/blog/archives/themeRomanticism.html'">Romanticism2.1</a></b> by <a class="chameleon underline" onclick="window.location.href='https://imakashi.eu.org/'"><b>Akashi</b></a>
      <br>
      Powered by <a class="chameleon underline" onclick="window.location.href='https://typecho.org'"><b>Typecho</b></a></small>
      <br><br>
    </div>

    <script>
        document.getElementById("switch-theme").addEventListener("click", () => {
            const isDark = document.body.classList.toggle("mdui-theme-layout-dark");
            if(isDark){
                localStorage.romanticismTheme = true;
            }else{
                delete localStorage.romanticismTheme;
            }
        });
    </script>

    <script src="<?php $this->options->themeUrl('config/mdui/js/mdui.min.js'); ?>"></script>
    <script src="<?php $this->options->themeUrl('config/js/jquery.min.js'); ?>"></script>
    
    <script src="<?php $this->options->themeUrl('config/js/listLazyload.js?v=2.1'); ?>"></script>
    <script src="<?php $this->options->themeUrl('config/js/tagIcon.js?v=2.1'); ?>"></script>
    <script src="<?php $this->options->themeUrl('config/js/customStyle.js?v=2.1'); ?>"></script>
    <script src="<?php $this->options->themeUrl('config/js/returntop.js?v=2.1'); ?>"></script>
    <script src="<?php $this->options->themeUrl('config/js/prism.highlight.js'); ?>"></script>

    <script src="<?php $this->options->themeUrl('config/js/jquery.fancybox.min.js'); ?>"></script>
    <script>
        $(document).ready(function () {
            $( ".fancybox").fancybox();
        });
    </script>

    <?php if (!empty($this->options->AKAROMfucset) && in_array('AKAROMindexloading', $this->options->AKAROMfucset)): ?>
    <script type="text/javascript" src="<?php $this->options->themeUrl('config/js/loading.js?v=2.1'); ?>"></script>
    <?php endif; ?>
    
    <!-- 增强的懒加载脚本 -->
    <script>
    document.addEventListener("DOMContentLoaded", function() {
        const lazyImages = [].slice.call(document.querySelectorAll("img.lazy, img[loading='lazy'], img.AKAROMlazyload"));
        
        if ("IntersectionObserver" in window) {
            let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
                entries.forEach(function(entry) {
                    if (entry.isIntersecting) {
                        let lazyImage = entry.target;
                        if (lazyImage.dataset.src) {
                            lazyImage.src = lazyImage.dataset.src;
                            lazyImage.removeAttribute("data-src");
                        }
                        if (lazyImage.dataset.bg) {
                            lazyImage.style.backgroundImage = "url('" + lazyImage.dataset.bg + "')";
                            lazyImage.removeAttribute("data-bg");
                        }
                        lazyImage.classList.remove("lazy");
                        lazyImage.classList.remove("AKAROMlazyload");
                        lazyImageObserver.unobserve(lazyImage);
                    }
                });
            });
            
            lazyImages.forEach(function(lazyImage) {
                lazyImageObserver.observe(lazyImage);
            });
        } else {
            // 回退到传统的延迟加载
            let active = false;
            
            const lazyLoad = function() {
                if (active === false) {
                    active = true;
                    
                    setTimeout(function() {
                        lazyImages.forEach(function(lazyImage) {
                            if ((lazyImage.getBoundingClientRect().top <= window.innerHeight && lazyImage.getBoundingClientRect().bottom >= 0) && getComputedStyle(lazyImage).display !== "none") {
                                if (lazyImage.dataset.src) {
                                    lazyImage.src = lazyImage.dataset.src;
                                    lazyImage.removeAttribute("data-src");
                                }
                                if (lazyImage.dataset.bg) {
                                    lazyImage.style.backgroundImage = "url('" + lazyImage.dataset.bg + "')";
                                    lazyImage.removeAttribute("data-bg");
                                }
                                lazyImage.classList.remove("lazy");
                                lazyImage.classList.remove("AKAROMlazyload");
                                
                                if (lazyImages.length === 0) {
                                    document.removeEventListener("scroll", lazyLoad);
                                    window.removeEventListener("resize", lazyLoad);
                                    window.removeEventListener("orientationchange", lazyLoad);
                                }
                            }
                        });
                        
                        active = false;
                    }, 200);
                }
            };
            
            document.addEventListener("scroll", lazyLoad);
            window.addEventListener("resize", lazyLoad);
            window.addEventListener("orientationchange", lazyLoad);
            lazyLoad();
        }
    });
    </script>
    
    <script src="<?php $this->options->themeUrl('config/js/OwO.js'); ?>"></script>
    <script>
    function OwO_show() {
        if ($(".OwO-items").css("max-height") == '0px') {
            $(".OwO").addClass("OwO-open");
        } else {
            $(".OwO").removeClass("OwO-open");
        }
    }
    </script>

    <!-- 自定义JS -->
    <?php if(!empty($this->options->AKAROMcustomJs)): ?>
        <script type="text/javascript">
            <?php $this->options->AKAROMcustomJs(); ?>
        </script>
    <?php endif; ?>

    <?php $this->footer(); ?>
</div>
</body>
</html>
