0%
boxmoe_header_banner_img

加载中

⌨️「footer.php 」 新增菜单成功,仍需要调试一些菜单功能bug


avatar
白木 2023年8月29日 2026年3月12日 2

备份日期:2026年3月13日00点17分

<?php
/**
 <em> @link https://www.boxmoe.com
 </em> @package lolimeow
 <em>/
//boxmoe.com===安全设置=阻止直接访问主题文件
if(!defined('ABSPATH')){echo'Look your sister';exit;}?>
        
        
<footer class="mt-7">
    
<hr class="horizontal dark">
      
        
        <?php echo boxmoe_load_assets_footer(); ?>
      
    </footer>
    
    
      
<nav class="floating-menu-items">
        
<ul>
          <?php if(get_boxmoe('boxmoe_blog_layout')=='two'): ?>
          
<li class="d-lg-none">
            <button class="float-btn" title="打开侧栏" data-bs-toggle="offcanvas" href="#blog-sidebar" aria-controls="blog-sidebar">
              <i class="fa fa-outdent"></i>
            </button>
          </li>
          <?php endif; ?>
          <?php if(get_boxmoe('boxmoe_lolijump_switch')): ?>
          
<li>
            <a id="lolijump" href="#" title="返回顶部">
              <img src="<?php echo boxmoe_theme_url(); ?>/assets/images/top/<?php echo get_boxmoe('boxmoe_lolijump_img'); ?>.gif" alt="返回顶部"></a>
          </li>
          <?php endif; ?>
        </ul>
      </nav>
    
    <?php
    ob_start();
    wp_footer();
    $wp_footer_output = ob_get_clean();
    echo preg_replace('/\n/', "\n    ", trim($wp_footer_output))."\n    ";
    ?>
    <?php echo get_boxmoe('boxmoe_diy_code_footer'); ?>
  </body>
</html>
<style>
.toast {
  transition: transform .3s ease-out !important;
    transform: translateX(100%);
}
.toast.fade.show {
    transform: translateX(0);
}
</style>
<script>
//文本复制监听,右上弹窗提示
document.addEventListener('DOMContentLoaded', function() {
    document.addEventListener('copy', function(event) {
        var copiedText = window.getSelection().toString();
        if (copiedText) {
            // 手动将选中的文本复制到剪贴板
            navigator.clipboard.writeText(copiedText).then(function() {
                // 复制成功后显示右上角弹窗
                showCopyNotification(copiedText);
            }, function(err) {
                // 复制失败处理
                console.error('复制失败:', err);
            });
        }
    });
});
function showCopyNotification(text) {
    var notification = document.createElement('div');
    notification.className = 'copy-notification';
    notification.style.position = 'fixed';
    notification.style.top = '20px';
    notification.style.right = '20px';
    notification.style.backgroundColor = 'rgba(123, 246, 255, 0.5)'; // 半透明背景
    notification.style.color = 'ff8e8eff';
    notification.style.padding = '15px 20px';
    notification.style.borderRadius = '20px'; // 圆角
    notification.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)'; // 阴影
    notification.style.zIndex = '9999';
    notification.style.transition = 'opacity 0.3s ease'; // 透明度过渡
    notification.style.opacity = '1';
    notification.style.backdropFilter = 'blur(80px)'; // 高斯模糊
    notification.style.webkitBackdropFilter = 'blur(10px)'; // 兼容性
    notification.innerHTML = '<strong>已复制:</strong> ' + text;
    document.body.appendChild(notification);
    // 3秒后自动消失
    setTimeout(function() {
        notification.style.opacity = '0';
        setTimeout(function() {
            document.body.removeChild(notification);
        }, 300);
    }, 3000);
}
</script>
<style>
/</em> 允许正文选中 + 菜单样式 <em>/
body </em>{-webkit-user-select:text!important;-moz-user-select:text!important;-ms-user-select:text!important;user-select:text!important}
#edgeCtx{display:none;position:absolute;background:rgba(255,255,255,.9);backdrop-filter:blur(90px);border-radius:20px;box-shadow:0 4px 8px rgba(0,0,0,.1);width:160px;z-index:9999}
#edgeCtx div{padding:6px 15px;cursor:pointer;color:#333;border-bottom:1px solid #eee}
#edgeCtx div:last-child{border:none}
#edgeCtx div:hover{background:rgba(255,138,138,.7);color:#fff}
</style>
    
新标签页打开
    
灵阈研都
    
复制
    
刷新
    
返回本都
    
迈步
    
回退
    
复制哈希ID
    
探索选中内容
<!-- 专门给 Edge 用的隐形 <a> -->
<a id="edgeA" style="position:absolute;top:-9999px" target="_blank" rel="noopener noreferrer"></a>
<script>
jQuery(function($){
    /<em> 右键菜单 </em>/
    $(document).on('contextmenu',function(e){
        e.preventDefault();
        $('#edgeCtx').css({top:e.pageY,left:e.pageX}).show();
        return false;
    });
    $(document).click(function(){$('#edgeCtx').hide();});
    $('#edgeCtx div').on('click',function(){
        var act=$(this).data('act');
        var sel=$.trim(window.getSelection().toString());
        switch(act){
            case 'open':
                if(!sel){alert('请先选中一段网址');return;}
                sel = /^https?:\/\//i.test(sel) ? sel : 'https://'+sel;
                /<em> Edge 专用:触发真实 <a> 点击 </em>/
                var a=document.getElementById('edgeA');
                a.href=sel;
                a.click();          // 不会被拦截
                break;
            case 'neighbor':
                window.location.href='<?php echo get_permalink(get_page_by_path("link")); ?>';
                break;
            case 'copy':
                if(!sel){alert('请选择文本');return;}
                navigator.clipboard?navigator.clipboard.writeText(sel):fallbackCopy(sel);
                break;
            case 'reload':
                window.location.reload();
                break;
            case 'home':
                window.location.href='<?php echo home_url(); ?>';
                break;
            case 'forward':
                window.history.forward();
                break;
            case 'back':
                window.history.back();
                break;
            case 'copyUrl':
                navigator.clipboard?navigator.clipboard.writeText(location.href):fallbackCopy(location.href);
                break;
            case 'search':
                if(!sel){alert('请选择文本');return;}
                window.location.href='<?php echo home_url("search/"); ?>'+encodeURIComponent(sel);
                break;
        }
        $('#edgeCtx').hide();
    });
    /<em> 降级复制函数 </em>/
    function fallbackCopy(t){
        var ta=document.createElement('textarea');
        ta.value=t;
        document.body.appendChild(ta);
        ta.select();
        document.execCommand('copy');
        document.body.removeChild(ta);
    }
});
</script>
上一次更新已经跑远惹✨ 计算中...
(‾◡◝) 本内容里的一些消息,可能已经跟不上时间啦~
感谢您的支持
微信赞赏

微信扫一扫

支付宝赞赏

支付宝扫一扫



评论(0)

查看评论列表

暂无评论


发表评论

表情 颜文字
插入代码

北京时间 (Asia/Shanghai)

后退
前进
刷新
复制
粘贴
全选
删除
返回首页
0%
目录
顶部
底部
📖 文章导读