Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ vite.config.js.timestamp-*
vite.config.ts.timestamp-*

TODO.md

temp/
43 changes: 26 additions & 17 deletions better-github-nav.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @name Better GitHub Navigation
// @name:zh-CN 更好的 GitHub 导航栏
// @namespace https://github.com/ImXiangYu/better-github-nav
// @version 0.1.33
// @version 0.1.38
// @description Add quick access to Dashboard, Trending, Explore, Collections, and Stars from GitHub's top navigation.
// @description:zh-CN 在 GitHub 顶部导航中加入 Dashboard、Trending、Explore、Collections、Stars 快捷入口,常用页面一键直达。
// @author Ayubass
Expand All @@ -16,7 +16,7 @@

(() => {
// src/constants.js
var SCRIPT_VERSION = "0.1.33";
var SCRIPT_VERSION = "0.1.38";
var CUSTOM_BUTTON_CLASS = "custom-gh-nav-btn";
var CUSTOM_BUTTON_ACTIVE_CLASS = "custom-gh-nav-btn-active";
var CUSTOM_BUTTON_COMPACT_CLASS = "custom-gh-nav-btn-compact";
Expand Down Expand Up @@ -169,8 +169,8 @@
align-items: center;
gap: 8px;
max-width: min(320px, calc(100vw - 16px));
background: #25292E;
color: #FFFFFF;
background: var(--color-neutral-emphasis-plus, #1f2328);
color: var(--color-fg-on-emphasis, #ffffff);
border-radius: 6px;
padding: 4px 8px;
font-size: 12px;
Expand All @@ -179,6 +179,9 @@
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
pointer-events: none;
box-sizing: border-box;
box-shadow: var(--color-shadow-medium, 0 8px 24px rgba(0,0,0,0.2));
border: 1px solid var(--color-border-default, transparent);
text-decoration: none;
}
.custom-gh-nav-tooltip[hidden] {
display: none !important;
Expand All @@ -187,40 +190,44 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-decoration: none;
}
.custom-gh-nav-tooltip-hint-container {
display: inline-flex;
align-items: center;
flex-shrink: 0;
margin-left: 4px;
text-decoration: none;
}
.custom-gh-nav-tooltip-kbd {
display: inline-flex;
align-items: center;
gap: 4px;
margin: 0;
padding: 0;
border: 0;
border: none !important;
box-shadow: none !important;
font: inherit;
color: inherit;
background: transparent;
background: transparent !important;
text-decoration: none !important;
}
.custom-gh-nav-tooltip-chord {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 16px;
height: 14px;
padding: 2px 4px;
display: inline-block;
vertical-align: middle;
padding: 0 4px;
border-radius: 4px;
border: 0;
background: #59636E;
color: #FFFFFF;
background: rgba(110, 118, 129, 0.4);
color: #ffffff;
font-size: 11px;
font-weight: 400;
line-height: 10px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
line-height: 18px;
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
text-transform: uppercase;
box-sizing: border-box;
border: none !important;
box-shadow: none !important;
text-decoration: none !important;
}
#${SETTINGS_OVERLAY_ID} {
position: fixed;
Expand Down Expand Up @@ -393,6 +400,8 @@
function setLinkText(aTag, text) {
aTag.removeAttribute("aria-describedby");
aTag.setAttribute("aria-label", text);
const icons = aTag.querySelectorAll("svg");
icons.forEach((icon) => icon.remove());
const innerSpan = aTag.querySelector("span");
if (innerSpan) {
innerSpan.textContent = text;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "better-github-nav",
"version": "0.1.33",
"version": "0.1.38",
"description": "Build tools for the Better GitHub Navigation userscript.",
"private": true,
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export function setLinkText(aTag, text) {
aTag.removeAttribute('aria-describedby');
aTag.setAttribute('aria-label', text);

// 移除所有已存在的图标(SVG),防止从模板克隆出错误的图标
const icons = aTag.querySelectorAll('svg');
icons.forEach(icon => icon.remove());

const innerSpan = aTag.querySelector('span');
if (innerSpan) {
innerSpan.textContent = text;
Expand Down
37 changes: 22 additions & 15 deletions src/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export function ensureStyles() {
align-items: center;
gap: 8px;
max-width: min(320px, calc(100vw - 16px));
background: #25292E;
color: #FFFFFF;
background: var(--color-neutral-emphasis-plus, #1f2328);
color: var(--color-fg-on-emphasis, #ffffff);
border-radius: 6px;
padding: 4px 8px;
font-size: 12px;
Expand All @@ -52,6 +52,9 @@ export function ensureStyles() {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
pointer-events: none;
box-sizing: border-box;
box-shadow: var(--color-shadow-medium, 0 8px 24px rgba(0,0,0,0.2));
border: 1px solid var(--color-border-default, transparent);
text-decoration: none;
}
.custom-gh-nav-tooltip[hidden] {
display: none !important;
Expand All @@ -60,40 +63,44 @@ export function ensureStyles() {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-decoration: none;
}
.custom-gh-nav-tooltip-hint-container {
display: inline-flex;
align-items: center;
flex-shrink: 0;
margin-left: 4px;
text-decoration: none;
}
.custom-gh-nav-tooltip-kbd {
display: inline-flex;
align-items: center;
gap: 4px;
margin: 0;
padding: 0;
border: 0;
border: none !important;
box-shadow: none !important;
font: inherit;
color: inherit;
background: transparent;
background: transparent !important;
text-decoration: none !important;
}
.custom-gh-nav-tooltip-chord {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 16px;
height: 14px;
padding: 2px 4px;
display: inline-block;
vertical-align: middle;
padding: 0 4px;
border-radius: 4px;
border: 0;
background: #59636E;
color: #FFFFFF;
background: rgba(110, 118, 129, 0.4);
color: #ffffff;
font-size: 11px;
font-weight: 400;
line-height: 10px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
line-height: 18px;
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
text-transform: uppercase;
box-sizing: border-box;
border: none !important;
box-shadow: none !important;
text-decoration: none !important;
}
#${SETTINGS_OVERLAY_ID} {
position: fixed;
Expand Down