MediaWiki:Common.js:修订间差异
来自Mindustry中文wiki
无编辑摘要 |
无编辑摘要 |
||
| 第12行: | 第12行: | ||
}); | }); | ||
}); | }); | ||
/* | /* Mindustry 顶部导航栏 - 暴力插入版 */ | ||
$(document).ready(function() { | |||
display: flex; | // 1. 定义菜单内容 (直接写死白色字体,防止看不见) | ||
var myMenu = ` | |||
<div id="mindustry-nav" style="display: flex; align-items: center; height: 100%; margin-left: 20px; z-index: 999;"> | |||
<a href="/index.php/首页" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">首页</a> | |||
<a href="/index.php/单位" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">单位</a> | |||
<a href="/index.php/建筑" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">建筑</a> | |||
<a href="/index.php/逻辑" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">逻辑</a> | |||
</div> | |||
`; | |||
// 2. 尝试插入到 Logo 所在的容器中 | |||
// Vector 2022 的 Logo 容器通常叫 .vector-header-start | |||
var target = $('.vector-header-start'); | |||
// 如果找不到,尝试找 .mw-logo (旧版兼容) | |||
if (target.length === 0) { | |||
target = $('.mw-logo').parent(); | |||
} | |||
} | |||
// 执行插入 | |||
target.append(myMenu); | |||
} | // 3. 调试信息 (按F12看控制台用) | ||
console.log("Mindustry 导航栏脚本已执行"); | |||
}); | |||
2025年11月29日 (六) 19:53的版本
/* 这里的任何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("复制成功!");
});
});
/* Mindustry 顶部导航栏 - 暴力插入版 */
$(document).ready(function() {
// 1. 定义菜单内容 (直接写死白色字体,防止看不见)
var myMenu = `
<div id="mindustry-nav" style="display: flex; align-items: center; height: 100%; margin-left: 20px; z-index: 999;">
<a href="/index.php/首页" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">首页</a>
<a href="/index.php/单位" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">单位</a>
<a href="/index.php/建筑" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">建筑</a>
<a href="/index.php/逻辑" style="color: #fff !important; font-weight: bold; font-size: 16px; margin-right: 20px; text-decoration: none;">逻辑</a>
</div>
`;
// 2. 尝试插入到 Logo 所在的容器中
// Vector 2022 的 Logo 容器通常叫 .vector-header-start
var target = $('.vector-header-start');
// 如果找不到,尝试找 .mw-logo (旧版兼容)
if (target.length === 0) {
target = $('.mw-logo').parent();
}
// 执行插入
target.append(myMenu);
// 3. 调试信息 (按F12看控制台用)
console.log("Mindustry 导航栏脚本已执行");
});
