Skip to content

Commit b2a14ae

Browse files
committed
Update 07/01/2026
1 parent c8069fd commit b2a14ae

10 files changed

Lines changed: 721 additions & 28 deletions

File tree

README.md

Lines changed: 93 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,15 @@ A powerful, pixel-perfect, single-page web application to download files or fold
1111
- **Beautiful UI**: Smooth animations, file previews, and 2.Ogress bars.
1212
- **Theming**: 8 Themes including Dracula, Cyberpunk, AMOLED, and more.
1313

14-
## 🛠️ Installation / Deployment
14+
## 🔗 How to Use Samrt Links
1515

16-
Since this requires no build step, deployment is instant.
16+
To share a direct download link with a friend, simply add the GitHub URL after the hash (`?=`):
1717

18-
### Option 1: GitHub Pages (Recommended)
19-
1. Fork this repository (or create a new one).
20-
2. Upload `index.html`, `style.css`, `script.js`, and `wiki.html`.
21-
3. Go to **Settings > Pages**.
22-
4. Select `main` branch and click **Save**.
23-
5. Your site is live!
18+
### Direct
19+
> [https://downgd.github.io/?=https://github.com/facebook/react/tree/main/packages](https://downgd.github.io/?=https://github.com/facebook/react/tree/main/packages)
2420
25-
### Option 2: Local Use
26-
1. Download the files.
27-
2. Open `index.html` in Chrome/Edge/Firefox.
28-
3. *Note: LocalStorage features work, but some browsers restrict clipboard access on local files.*
29-
30-
## 🔗 How to Use Smart Links
31-
32-
To share a direct download link with a friend, simply add the GitHub URL after the hash (`#`):
33-
34-
`https://your-site.github.io/#/github.com/facebook/react/tree/main/packages`
21+
### With Name
22+
> [https://downgd.github.io/?=https://github.com/facebook/react/tree/main/packages&name=react-core](https://downgd.github.io/?=https://github.com/facebook/react/tree/main/packages&name=react-core)
3523
3624
When the user visits this link, the app will:
3725
1. Parse the URL.
@@ -44,7 +32,93 @@ When the user visits this link, the app will:
4432
2. Scopes needed: `repo` (for private) or just public access.
4533
3. Open DownGD 2.O > Click Gear Icon (⚙️).
4634
4. Paste token. It is saved in your browser's LocalStorage and never sent to any 3rd party server.
35+
Got it 👍
36+
Below are **ONLY the two new sections** you asked for — **Script details** and **Extension details** — written to drop directly into your existing README **without changing anything else**.
37+
38+
---
39+
## 🔗 Api
40+
41+
To embed a direct download link with in your website/page, simply use this pattern
42+
43+
### embed as a link
44+
```html
45+
<a href="https://downgd.github.io/api/?=https://github.com/facebook/react/tree/main/packages&name=react-cor"></a>
46+
```
47+
### or use like this js
48+
```javascript
49+
function triggerDownload() {
50+
const repo = "https://github.com/facebook/react/tree/main/packages";
51+
const apiUrl = `https://git-zip-pro.vercel.app/api/?url=${repo}`;
52+
53+
window.open(apiUrl, '_blank');
54+
}
55+
```
56+
## 📜 Userscript
57+
58+
DownGD also provides a **GitHub-integrated userscript** that adds a native-looking **Download button directly inside GitHub menus**.
59+
60+
### ✨ What the Userscript Does
61+
62+
* Injects a **“Download Repo / Folder / File”** action into GitHub’s context menus
63+
* Automatically detects:
64+
65+
* **Repository menu** → shows **Download Repo**
66+
* **Folder menu** → shows **Download Folder**
67+
* **File menu** → shows **Download**
68+
* Opens a **GitHub-themed custom popup** to set an optional download name
69+
* Auto-fills the popup with the current repo / folder / file name
70+
* Fully matches GitHub light & dark themes
71+
* Uses the official **DownGD API** under the hood
72+
73+
### 🧩 Supported Script Runners
74+
75+
* Tampermonkey
76+
* Violentmonkey
77+
* ScriptRunner (Chromium-based extensions)
78+
* Other userscript-compatible extensions
79+
80+
### 🛠️ How to Install
81+
82+
1. Install a userscript manager (Tampermonkey / ScriptRunner).
83+
2. Create a **new userscript**.
84+
3. Paste the provided [DownGD userscript](https://downgd.github.io/script/downgd-download-button-user.js) code or direct link in url bar.
85+
4. Save and enable the script.
86+
5. Visit any GitHub repository, folder, or file.
87+
6. Open the GitHub menu → click **Download Repo / Folder / Download**.
88+
89+
> No configuration required. Works instantly on GitHub pages.
90+
91+
---
92+
93+
## 🧩 Browser Extension
94+
95+
The DownGD userscript can also be packaged as a **lightweight browser extension** using ScriptRunner-style extensions.
96+
97+
## [Download Now](https://downgd.github.io/api/?=https://github.com/DownGD/downgd.github.io/tree/main/extension&name=Extension)
98+
### 🚀 Extension Capabilities
99+
100+
* Zero background services
101+
* No permissions beyond GitHub pages
102+
* Runs fully client-side
103+
* Injects UI only when GitHub menus are detected
104+
* SPA-safe (works with GitHub Turbo / PJAX navigation)
105+
106+
### 📦 Extension Use Cases
107+
108+
* Personal daily GitHub usage
109+
* Developers frequently downloading subfolders
110+
* Lightweight alternative to full GitHub downloader extensions
111+
* No tracking, no analytics, no servers
112+
113+
### 🔐 Privacy
114+
115+
* No data is collected
116+
* No GitHub tokens are accessed by the script
117+
* Downloads are handled entirely by **DownGD API** in a new tab
118+
119+
---
120+
47121

48122
## 🤝 Contributing
49123

50-
Feel free to open issues or submit PRs. The code is written in vanilla JS/CSS for maximum simplicity and performance.
124+
Feel free to open issues or submit PRs. The code is written in JS/CSS for maximum simplicity and performance.

api/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ You can use an `iframe` or `window.open` to trigger downloads from your own webs
5353
```javascript
5454
function triggerDownload() {
5555
const repo = "https://github.com/facebook/react/tree/main/packages";
56-
const apiUrl = `https://git-zip-pro.vercel.app/api.html?url=${repo}`;
56+
const apiUrl = `https://git-zip-pro.vercel.app/api/?url=${repo}`;
5757

5858
window.open(apiUrl, '_blank');
5959
}

extension/content.js

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
(() => {
2+
const n = "downgd-modal";
3+
function e(e) {
4+
const linkPadding = e === "repo" ? "revert-layer" : "0";
5+
const o = (function () {
6+
const n = location.pathname.split("/").filter(Boolean);
7+
return 2 === n.length
8+
? { type: "repo", name: `${n[0]}-${n[1]}` }
9+
: n.includes("tree")
10+
? { type: "folder", name: n[n.length - 1] }
11+
: n.includes("blob")
12+
? { type: "file", name: n[n.length - 1] }
13+
: { type: "unknown", name: "github-download" };
14+
})(),
15+
t = document.createElement("li");
16+
var r;
17+
return (
18+
(t.className = "prc-ActionList-ActionListItem-So4vC"),
19+
(t.innerHTML = `<a class="prc-ActionList-ActionListContent-KBb8- prc-Link-Link-9ZwDx" role="menuitem" tabindex="-1" data-downgd="${e}" style="padding:${linkPadding};">
20+
21+
22+
<span class="prc-ActionList-Spacer-4tR2m"></span>
23+
<span class="prc-ActionList-LeadingVisual-NBr28 prc-ActionList-VisualWrap-bdCsS">
24+
${
25+
((r = e),
26+
"repo" === r
27+
? '<svg aria-hidden="true" focusable="false" class="octicon octicon-download" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"><path d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"></path><path d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"></path></svg>'
28+
: "folder" === r
29+
? '<svg style="width: 0;height: 0;"></svg>'
30+
: '<svg style="width: 0;height: 0;"></svg>')
31+
}
32+
</span>
33+
<span class="prc-ActionList-ActionListSubContent-gKsFp" data-component="ActionList.Item--DividerContainer">
34+
<span class="prc-ActionList-ItemLabel-81ohH">
35+
${
36+
((r = e),
37+
"repo" === r
38+
? "Download Repo"
39+
: "folder" === r
40+
? "Download Folder"
41+
: "Download")
42+
}
43+
</span></span></a>`),
44+
(t.onclick = () => {
45+
!(function (e, o) {
46+
if (document.getElementById(n)) return;
47+
document.documentElement.dataset.colorMode;
48+
const t = document.createElement("div");
49+
(t.id = n),
50+
(t.innerHTML = `
51+
<style>
52+
#${n} {position: fixed;
53+
inset: 0;
54+
z-index: 99999;
55+
display: flex;
56+
align-items: center;
57+
justify-content: center;
58+
}
59+
.modal-overlay {
60+
display: block;
61+
position: fixed;
62+
width: -webkit-fill-available;
63+
height: -webkit-fill-available;
64+
}
65+
.dg-box {
66+
background:var(--overlay-bgColor,var(--color-canvas-overlay));
67+
color: var(--fgColor-default);
68+
width: 340px;padding: 16px;
69+
border-radius: 12px;border: 1px solid var(--color-border-default);
70+
box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));
71+
font-family: system-ui;
72+
animation:prc-Overlay-overlay-appear-JpFey .2s cubic-bezier(.33,1,.68,1);z-index:10001;
73+
}
74+
.dg-box h3 {
75+
text-align: center;
76+
background-color: initial;
77+
color: var(--fgColor-default,var(--color-fg-default));
78+
font-size: 18px;font-weight: 700;
79+
margin: 0 auto 5px;
80+
}
81+
.dg-box input {
82+
width: 100%;
83+
padding: 8px;
84+
margin-top: 10px;
85+
border-radius: 8px;
86+
background: var(--bgColor-disabled);
87+
border: 1px solid var(--control-borderColor-rest, var(--color-border-default));
88+
outline: 1px solid;
89+
color: var(--fgColor-default, var(--color-fg-default));
90+
}
91+
.dg-actions {
92+
margin-top: 16px;
93+
font-weight: 800;
94+
display: flex;
95+
justify-content: space-around;
96+
}
97+
.dg-actions button {
98+
padding: 6px 12px;
99+
border-radius: 6px;
100+
border: none;
101+
cursor: pointer;
102+
font-size: 13px;
103+
}
104+
.dg-cancel {
105+
background: var(--button-default-bgColor-rest);
106+
}
107+
.dg-cancel:hover,.dg-cancel:focus, {
108+
background: var(--button-default-bgColor-hover);
109+
}
110+
.dg-confirm {
111+
background: var(--button-primary-bgColor-rest);
112+
color:var(--button-primary-fgColor-rest,var(--color-btn-primary-text));
113+
}
114+
.dg-confirm:hover,.dg-confirm:focus, {
115+
background: var(--button-primary-bgColor-hover);
116+
}
117+
</style>
118+
<div class="modal-overlay"></div>
119+
<div class="dg-box">
120+
<h3>Custom download name</h3>
121+
<input id="dg-name" value="${e}"/>
122+
<div class="dg-actions">
123+
<button class="dg-cancel">Cancel</button>
124+
<button class="dg-confirm">Download</button>
125+
</div>
126+
</div>
127+
`),
128+
document.body.appendChild(t),
129+
t.querySelector(".modal-overlay").addEventListener("click", () => {
130+
t.remove();
131+
}),
132+
t.querySelector(".dg-cancel").addEventListener("click", () => {
133+
t.remove();
134+
}),
135+
t.querySelector(".dg-confirm").addEventListener("click", () => {
136+
const n = t.querySelector("#dg-name").value.trim() || e;
137+
t.remove(), o(n);
138+
}),
139+
document.addEventListener(
140+
"keydown",
141+
(n) => {
142+
"Escape" === n.key && t.remove();
143+
},
144+
{ once: !0 }
145+
);
146+
})(o.name, (n) => {
147+
window.open(
148+
`https://downgd.github.io/api/?url=${encodeURIComponent(
149+
location.href
150+
)}&name=${encodeURIComponent(n)}`,
151+
"_blank"
152+
);
153+
});
154+
}),
155+
t
156+
);
157+
}
158+
function o() {
159+
document
160+
.querySelectorAll("ul.prc-ActionList-ActionList-rPFF2")
161+
.forEach((n) => {
162+
const o = (function (n) {
163+
const e = n.innerText;
164+
return e.includes("Download ZIP")
165+
? "repo"
166+
: e.includes("Copy path") && !e.includes("Raw file")
167+
? "folder"
168+
: e.includes("Raw file content")
169+
? "file"
170+
: null;
171+
})(n);
172+
o &&
173+
(n.querySelector(`[data-downgd="${o}"]`) ||
174+
n.insertBefore(e(o), n.firstElementChild));
175+
});
176+
}
177+
new MutationObserver(o).observe(document.body, {
178+
childList: !0,
179+
subtree: !0,
180+
}),
181+
o();
182+
})();

extension/icon.png

10.1 KB
Loading

extension/manifest.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "DownGD Download Button",
4+
"version": "1.0.0",
5+
"description": "Adds a DownGD Api Download button to GitHub repo and directory menus.",
6+
"permissions": [],
7+
"content_scripts": [
8+
{
9+
"matches": ["https://github.com/*"],
10+
"js": ["content.js"],
11+
"run_at": "document_idle"
12+
}
13+
],
14+
"icons": {
15+
"128": "icon.png"
16+
}
17+
}
18+
19+

0 commit comments

Comments
 (0)