User:GuoPC/js/AccesskeyMoe.js
注意:在您儲存之後您必須清除瀏覽器快取才可看到最新的變動。
- Firefox / Safari:按住「Shift」時點選「重新整理」,或按「Ctrl-F5」或「Ctrl-R」 (Mac則為「⌘-R」)
- Google Chrome:按「Ctrl-Shift-R」 (Mac 則為「⌘-Shift-R」)
- Internet Explorer:按住「Ctrl」時點選「重新整理」,或按「Ctrl-F5」
- Opera:進入「工具→偏好設定」中清除快取。
- 如果您已登入但該頁面出現未登入狀態,請嘗試在網址列的URL最後新增代碼
?_=1
來訪問最新頁面。
// 添加 Vector 皮膚下的快捷鍵
$(function() {
if ($(".dropdown-link").length > 0) {
$(".links-group:eq(0) .dropdown-list-item:eq(0) a").attr("accesskey", "z"); // 訪問首頁
$(".links-group:eq(0) .dropdown-list-item:eq(1) a").attr("accesskey", "x"); // 隨機頁面
$(".links-group:eq(0) .dropdown-list-item:eq(2) a").attr("accesskey", "r"); // 最近更改
}
});
// 顯示快捷鍵
mw.loader.addStyleTag(`
.dropdown-key::after {
content: attr(accesskey);
display: block;
position: absolute;
bottom: 5px;
right: 10px;
background: var(--theme-accent-color);
border-radius: 3px;
color: #FFF;
font-family: monospace;
font-size: 0.8em;
font-weight: bold;
line-height: 1.1rem;
text-transform: capitalize;
padding: 0px 2px;
user-select: none;
}
.toolbar-key::after {
content: attr(accesskey);
position: absolute;
right: -8px;
bottom: -2px;
display: inline-block;
background: #FFF;
border-radius: 2px;
box-shadow: var(--theme-card-box-shadow);
color: var(--theme-accent-color);
font-family: monospace;
font-size: xx-small;
font-weight: bold;
text-shadow: none;
text-transform: capitalize;
margin: 0px 2px;
padding: 2px;
user-select: none;
z-index: 3;
}
`);
$(function() {
if ($(".dropdown-link").length > 0 && $(".toolbar-link").length > 0 && $(".dropdown-content").length > 0) {
$(".dropdown-link, .dropdown-content a").each(function () {
if ($(this).attr("accesskey")) {
$(this).css('position', 'relative');
$(this).addClass('dropdown-key');
}
});
$(".toolbar-link a").each(function () {
if ($(this).attr("accesskey")) {
$(this).css('position', 'relative');
$(this).addClass('toolbar-key');
}
});
}
});
此頁面最後編輯於 2022年11月25日 (星期五) 11:25。