Skip to content

Commit 4ea8d9c

Browse files
committed
feat(gist): 在个人资料页显示查看 Gist 资料并修改Code按钮查找逻辑
1 parent 2a8dc2d commit 4ea8d9c

File tree

3 files changed

+48
-10
lines changed

3 files changed

+48
-10
lines changed

github-repo-size-view/AUTHORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--458048,494365,529862-->
1+
<!--458048,494365,529862,559202-->
22
<!--AUTHORS-->
33
## 💖 脚本参考或使用了以下脚本:
44
[🧑‍💻 **@mshll**](https://greasyfork.org/users/1010122) ⇒ 📜 _[Github Repo Size](https://greasyfork.org/scripts/458048)_<br>

github-repo-size-view/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# **🛠️ GitHub Repo Size+ 升级日志**
22

3+
### **📅 2026.3.16.1**
4+
5+
**新增**: 在个人资料页显示`查看 Gist 资料`<br>![2026.03.16](https://files.seeusercontent.com/2026/03/16/1Kqb/pic_1773644853242.png)<br>来自[GitHub: View User Gists](https://greasyfork.org/zh-CN/scripts/559202)<br>
6+
**修复**: 修改`Code`按钮查找逻辑<br>
7+
8+
---
9+
310
### **📅 2026.3.14.1**
411

512
**修复**: 更换`Code`按钮选择路径,更改监听类型,删除固定导航栏覆盖优先级<br>

github-repo-size-view/github-repo-size-view.user.js

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
// @description:zh-HK 🤠 倉庫顯示大小:在 GitHub 的程式碼搜尋、倉庫搜尋、議題頁面、使用者倉庫清單和儲存庫頁面上,倉庫名稱旁會顯示該倉庫的大小,方便使用者快速了解倉庫的規模,最佳化選擇。不活躍開發警告:如果某個倉庫在過去六個月內沒有更新,系統會在倉庫的頂部添加提示,提醒用戶該倉庫不活躍,並顯示最後一次更新的時間。這有助於使用者判斷倉庫的活躍程度和維護狀況。倉庫內快速跳轉:在瀏覽倉庫時,使用者可以方便地查看該使用者的所有倉庫列表,提供一個快速跳到不同倉庫的入口。用戶可以快速找到和存取感興趣的其他項目,提高工作效率。使用情境:開發者:可以透過顯示倉庫大小和活躍警告,快速篩選出適當的庫進行開發,避免使用不再維護的項目。專案管理者:透過快速跳轉功能,方便管理和協調多個項目,提高工作效率。學習者:在學習新科技時,可以更方便地找到相關的開源項目,快速查看專案的活躍程度和規模。 🤠
8181
// @description:fr-CA 🤠 Taille d’affichage de l’entrepôt : sur la recherche de code, la recherche d’entrepôt, la page de problèmes, la liste d’entrepôts d’utilisateurs et la page de référentiel de GitHub, la taille de l’entrepôt sera affichée à côté du nom de l’entrepôt, permettant aux utilisateurs de comprendre rapidement l’échelle de l’entrepôt et d’optimiser leur sélection. Avertissement de développement inactif : si un référentiel n’a pas été mis à jour au cours des six derniers mois, le système ajoutera une invite en haut du référentiel pour rappeler aux utilisateurs que le référentiel est inactif et affichera l’heure de la dernière mise à jour. Cela aide les utilisateurs à déterminer l’activité et l’état de maintenance de l’entrepôt. Saut rapide dans l’entrepôt : lors de la navigation dans l’entrepôt, l’utilisateur peut facilement consulter la liste de tous les entrepôts de l’utilisateur, offrant ainsi une entrée pour accéder rapidement à différents entrepôts. Les utilisateurs peuvent trouver et accéder rapidement à d’autres projets d’intérêt, améliorant ainsi l’efficacité du travail. Scénarios d’utilisation : Développeurs : en affichant la taille de l’entrepôt et les avertissements actifs, vous pouvez rapidement filtrer les bibliothèques appropriées pour le développement et éviter d’utiliser des projets qui ne sont plus maintenus. Gestionnaire de projet : grâce à la fonction de saut rapide, il est facile de gérer et de coordonner plusieurs projets et d’améliorer l’efficacité du travail. Apprenants : lorsqu’ils apprennent de nouvelles technologies, ils peuvent plus facilement trouver des projets open source pertinents et vérifier rapidement l’activité et l’ampleur des projets. 🤠
8282
// @namespace https://github.com/ChinaGodMan/UserScripts
83-
// @version 2026.3.14.1
84-
// @author mshll & 人民的勤务员 <china.qinwuyuan@gmail.com>
83+
// @version 2026.3.16.1
84+
// @author Khalila Gazal,mshll & 人民的勤务员 <china.qinwuyuan@gmail.com>
8585
// @match https://github.com/*
8686
// @run-at document-start
8787
// @grant GM_getValue
@@ -107,7 +107,7 @@
107107
* File Created: 2024/11/24,Sunday 12:38:48
108108
* Author: 人民的勤务员@ChinaGodMan (china.qinwuyuan@gmail.com)
109109
* -----
110-
* Last Modified: 2026/03/14,Saturday 01:35:39
110+
* Last Modified: 2026/03/16,Monday 15:09:30
111111
* Modified By: 人民的勤务员@ChinaGodMan (china.qinwuyuan@gmail.com)
112112
* -----
113113
* License: MIT License
@@ -167,7 +167,8 @@ const translations = {
167167
get_more_repos_perpage: 'Quickly jump to the repositories below to get the number displayed per page',
168168
fixed_head: 'Fixed page navigation bar',
169169
fixed_head_on_mobile: 'Fixed page navigation bar on mobile devices',
170-
refresh_time: 'Enter the refresh time of the local cache (Format 1: 1s1m1s Format 2: 10h Format 3: 10s etc...)'
170+
refresh_time: 'Enter the refresh time of the local cache (Format 1: 1s1m1s Format 2: 10h Format 3: 10s etc...)',
171+
gist_profile: 'View Gist Profile'
171172

172173
},
173174
'zh-CN,zh,zh-SG': {
@@ -217,7 +218,8 @@ const translations = {
217218
get_more_repos_perpage: '快捷跳转仓库-下方输入获取每页显示的数量',
218219
fixed_head: '固定页面导航栏',
219220
fixed_head_on_mobile: '移动设备上固定页面导航栏',
220-
refresh_time: '输入本地缓存的刷新时间(格式1:1s1m1s 格式2:10h 格式3:10s 等等...)'
221+
refresh_time: '输入本地缓存的刷新时间(格式1:1s1m1s 格式2:10h 格式3:10s 等等...)',
222+
gist_profile: '查看 Gist 个人资料'
221223
},
222224
'zh-TW,zh-HK,zh-MO': {
223225
save: '保存',
@@ -667,6 +669,34 @@ document.addEventListener('turbo:load', () => {
667669
})
668670
}
669671
})
672+
673+
//!SECTION 插入个人Gist资料
674+
// Run the script again when navigating to a new page without a refresh
675+
document.addEventListener('DOMContentLoaded', injectGistButton)
676+
function injectGistButton() {
677+
// Find the sidebar area where the 'Follow' button is located
678+
const sidebar = document.querySelector('.js-profile-editable-area')
679+
680+
// Stop if the sidebar isn't found or if the button is already there
681+
if (!sidebar || document.getElementById('gist-profile-link')) return
682+
683+
// Get the username from the address bar
684+
const username = window.location.pathname.split('/')[1]
685+
686+
// Create the link and make it look like a GitHub button
687+
const btn = document.createElement('a')
688+
btn.id = 'gist-profile-link'
689+
btn.innerText = translate.gist_profile
690+
btn.href = `https://gist.github.com/${username}`
691+
btn.className = 'btn btn-block mt-2'
692+
693+
// Put the button into the sidebar
694+
sidebar.appendChild(btn)
695+
}
696+
697+
// Run the script when the page first opens
698+
injectGistButton()
699+
670700
/* document.addEventListener('turbo:load', () => {
671701
addSizeToRepos()
672702
}) */ //!SECTION-网络不顺畅时,加载太慢
@@ -844,10 +874,11 @@ function insertReposList(links, tip = false) {
844874
'.faNtbn .d-flex.gap-2', // Repo files page
845875
'.gwHaUx .d-flex.gap-2' // Commits page
846876
]
847-
// document.querySelector(selectors.join(', '))
848-
// document.getElementById(':R55ab:')直接选择code按钮 使用中文化脚本元素变化选择(':rn:')
849-
const buttons = document.querySelectorAll('button[class="prc-Button-ButtonBase-9n-Xk"]')
850-
const existingButton = buttons[buttons.length - 1]
877+
878+
const buttons = Array.from(document.querySelectorAll('button[class^="prc-Button-ButtonBase-"]')).find(
879+
btn => ['代码', 'Code'].includes(btn.textContent.trim())
880+
)
881+
const existingButton = buttons
851882
if (existingButton) {
852883
const sortedLinks = links.sort((a, b) => {//!SECTION 排序
853884
// 首先比较 fork 下沉到数组的低端.

0 commit comments

Comments
 (0)