feat: Add YouTube Chrome extension and GDM API - Chrome extension with popup UI, quality selection, server config - YouTube API endpoints: youtube_add, youtube_formats - Background worker with context menu integration - Content script with inline download button

This commit is contained in:
2026-01-08 19:33:18 +09:00
parent 5afb082692
commit c7a3d6fd03
13 changed files with 923 additions and 1 deletions

263
chrome_extension/popup.css Normal file
View File

@@ -0,0 +1,263 @@
/* GDM YouTube Downloader - Popup Styles */
:root {
--primary: #3b82f6;
--primary-hover: #2563eb;
--success: #10b981;
--error: #ef4444;
--bg-dark: #0f172a;
--bg-card: #1e293b;
--text: #e2e8f0;
--text-muted: #94a3b8;
--border: rgba(255, 255, 255, 0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 360px;
min-height: 400px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg-dark);
color: var(--text);
}
.container {
padding: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}
header {
display: flex;
align-items: center;
gap: 8px;
}
header h1 {
font-size: 18px;
font-weight: 600;
}
.section {
display: flex;
flex-direction: column;
gap: 12px;
}
.hidden {
display: none !important;
}
/* Loading */
.spinner {
width: 40px;
height: 40px;
border: 3px solid var(--border);
border-top-color: var(--primary);
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 20px auto;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Video Info */
.video-info {
display: flex;
gap: 12px;
padding: 12px;
background: var(--bg-card);
border-radius: 12px;
border: 1px solid var(--border);
}
.video-info img {
width: 120px;
height: 68px;
object-fit: cover;
border-radius: 8px;
}
.video-meta {
flex: 1;
display: flex;
flex-direction: column;
gap: 4px;
}
.video-meta h3 {
font-size: 14px;
font-weight: 500;
line-height: 1.3;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.duration {
font-size: 12px;
color: var(--text-muted);
}
/* Quality Section */
.quality-section {
display: flex;
flex-direction: column;
gap: 8px;
}
.quality-section label {
font-size: 13px;
font-weight: 600;
color: var(--text-muted);
}
.quality-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
.quality-option {
padding: 10px 12px;
background: var(--bg-card);
border: 2px solid var(--border);
border-radius: 8px;
cursor: pointer;
transition: all 0.2s;
text-align: center;
}
.quality-option:hover {
border-color: var(--primary);
background: rgba(59, 130, 246, 0.1);
}
.quality-option.selected {
border-color: var(--primary);
background: rgba(59, 130, 246, 0.2);
}
.quality-option .label {
font-size: 13px;
font-weight: 600;
}
.quality-option .note {
font-size: 11px;
color: var(--text-muted);
}
/* Server Section */
.server-section {
display: flex;
flex-direction: column;
gap: 6px;
}
.server-section label {
font-size: 13px;
font-weight: 600;
color: var(--text-muted);
}
.server-section input {
padding: 10px 12px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-size: 13px;
}
.server-section input:focus {
outline: none;
border-color: var(--primary);
}
.server-section small {
font-size: 11px;
color: var(--text-muted);
}
/* Buttons */
.btn {
padding: 12px 16px;
border: none;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.btn-primary {
background: linear-gradient(135deg, var(--primary), var(--primary-hover));
color: white;
}
.btn-primary:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}
.btn-primary:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.btn-secondary {
background: var(--bg-card);
color: var(--text);
border: 1px solid var(--border);
}
/* Status */
.status {
padding: 10px 12px;
border-radius: 8px;
font-size: 13px;
text-align: center;
}
.status.success {
background: rgba(16, 185, 129, 0.2);
color: var(--success);
}
.status.error {
background: rgba(239, 68, 68, 0.2);
color: var(--error);
}
.status.info {
background: rgba(59, 130, 246, 0.2);
color: var(--primary);
}
/* Error */
.error-text {
color: var(--error);
text-align: center;
}
footer {
text-align: center;
color: var(--text-muted);
padding-top: 8px;
border-top: 1px solid var(--border);
}