Skip to content

Commit aae83d7

Browse files
committed
init: 🎉 添加 Github 仪表盘页面自动加载更多脚本
1 parent 6cb7e23 commit aae83d7

7 files changed

Lines changed: 110 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# github-dashboard-auto-more
2+
3+
## 1.0.0
4+
5+
### Major Changes
6+
7+
- init
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# GitHub 仪表盘页面自动加载更多(GitHub Dashboard Auto More)
2+
3+
**我负责点,你负责看!**
4+
5+
## 📋 更新日志
6+
7+
[CHANGELOG](https://github.com/xiaohuohumax/userscripts/blob/main/apps/github/dashboard-auto-more/CHANGELOG.md)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "github-dashboard-auto-more",
3+
"type": "module",
4+
"version": "1.0.0",
5+
"private": true,
6+
"description": "GitHub 仪表盘页面自动加载更多(GitHub Dashboard Auto More)-- 我负责点,你负责看!",
7+
"author": {
8+
"name": "xiaohuohumax",
9+
"url": "https://github.com/xiaohuohumax"
10+
},
11+
"license": "MIT",
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/xiaohuohumax/userscripts.git"
15+
},
16+
"keywords": [
17+
"typescript",
18+
"tampermonkey",
19+
"github",
20+
"dashboard"
21+
],
22+
"scripts": {
23+
"dev": "vite",
24+
"build": "vite build --emptyOutDir=false"
25+
},
26+
"devDependencies": {
27+
"vite-plugin-meta": "workspace:^"
28+
}
29+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { debounce } from 'radash'
2+
import { ID, VERSION } from 'virtual:meta'
3+
4+
console.log(`${ID}(v${VERSION})`)
5+
6+
function autoClick() {
7+
const selectors = '.ajax-pagination-btn.color-bg-overlay'
8+
const moreButton = document.querySelector<HTMLButtonElement>(selectors)
9+
if (!moreButton) {
10+
return
11+
}
12+
const rect = moreButton.getBoundingClientRect()
13+
const isVisible = rect.top < window.innerHeight * 2 && rect.bottom > 0
14+
isVisible && moreButton.click()
15+
}
16+
17+
const handleScroll = debounce({ delay: 100 }, autoClick)
18+
handleScroll()
19+
window.addEventListener('scroll', handleScroll)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "../../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"types": [
5+
"vite/client",
6+
"vite-plugin-monkey/client",
7+
"vite-plugin-meta/client"
8+
]
9+
},
10+
"include": [
11+
"src",
12+
"*.d.ts"
13+
]
14+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { defineConfig } from 'vite'
2+
import meta from 'vite-plugin-meta'
3+
import monkey from 'vite-plugin-monkey'
4+
5+
export default defineConfig({
6+
build: {
7+
outDir: '../../../dist/',
8+
},
9+
plugins: [
10+
meta(),
11+
monkey({
12+
entry: 'src/index.ts',
13+
userscript: {
14+
name: 'GitHub 仪表盘页面自动加载更多(GitHub Dashboard Auto More)',
15+
description: '我负责点,你负责看!',
16+
icon: 'https://github.githubassets.com/favicons/favicon-dark.png',
17+
namespace: 'xiaohuohumax/userscripts/dashboard-auto-more',
18+
license: 'MIT',
19+
updateURL: 'https://raw.githubusercontent.com/xiaohuohumax/userscripts/main/dist/dashboard-auto-more.user.js',
20+
downloadURL: 'https://raw.githubusercontent.com/xiaohuohumax/userscripts/main/dist/dashboard-auto-more.user.js',
21+
noframes: true,
22+
match: [
23+
'https://github.com',
24+
],
25+
},
26+
}),
27+
],
28+
})

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)