MediaWiki:Common.js

来自Mindustry中文wiki
绿豆留言 | 贡献2025年11月29日 (六) 17:30的版本

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
/* 点击按钮复制内容的脚本 */
$(function() {
    $('.copy-button').click(function() {
        var text = $(this).attr('data-text');
        var $temp = $("<textarea>");
        $("body").append($temp);
        $temp.val(text).select();
        document.execCommand("copy");
        $temp.remove();
        alert("复制成功!");
    });
});
/* ========== 自定义顶部菜单样式 ========== */
#custom-top-nav {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: 20px; /* 距离 Logo 的距离 */
    flex-grow: 1;      /* 让它占据中间的空间 */
}

#custom-top-nav a {
    color: #333;       /* 文字颜色 (如果是深色背景改为 #fff) */
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    padding: 0 15px;   /* 按钮左右间距 */
    line-height: 50px; /* 垂直居中 */
    transition: 0.3s;
    border-radius: 4px;
}

#custom-top-nav a:hover {
    background-color: #eee; /* 鼠标悬停背景色 (深色模式改为 #444) */
    color: #000;            /* 鼠标悬停文字色 */
}