// ==UserScript== // @name GitHub Repo Tree Generator // @namespace http://tampermonkey.net/ // @version 1.1 // @description Generate, filter, and share a clean directory tree for any GitHub repo // @author Azad-sl // @homepage https://github.com/Azad-sl/GitTree // @license MIT // @match https://github.com/* // @grant GM_addStyle // @grant GM_setClipboard // @grant GM_download // @require https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js // @downloadURL https://update.greasyfork.org/scripts/544254/GitHub%20Repo%20Tree%20Generator.user.js // @updateURL https://update.greasyfork.org/scripts/544254/GitHub%20Repo%20Tree%20Generator.meta.js // ==/UserScript== (function() { 'use strict'; GM_addStyle(` /* 弹窗样式 */ .gittree-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; z-index: 9999; } .gittree-modal-content { background-color: white; border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15); width: 90%; max-width: 800px; max-height: 90vh; overflow-y: auto; padding: 2rem; position: relative; } .gittree-close-btn { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #6e6e73; } .gittree-close-btn:hover { color: #1d1d1f; } /* GitHub页面上的按钮样式 */ .gittree-btn { background-color: #238636; color: white; border: none; border-radius: 6px; padding: 5px 12px; font-size: 14px; font-weight: 500; cursor: pointer; margin-left: 8px; } .gittree-btn:hover { background-color: #2ea043; } /* GitTree应用样式 */ .gittree-container { box-sizing: border-box; position: relative; width: 100%; max-width: 800px; background-color: #fff; border: 1px solid #d2d2d7; border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.05); padding: 2rem 2.5rem 2.5rem; } .gittree-container h1 { text-align: center; font-size: 2rem; font-weight: 600; margin-top: 0; margin-bottom: 0.5rem; } .gittree-container .subtitle { text-align: center; font-size: 1rem; color: #6e6e73; margin-bottom: 2rem; } .gittree-container pre#gittree-result { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 0.9rem; color: #1d1d1f; white-space: pre; padding: 1.5rem; margin: 0; max-height: 50vh; overflow: auto; line-height: 1.6; background-color: #fff; } .gittree-container pre#gittree-result.error { color: #d73a49; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; white-space: normal; } .gittree-container .input-wrapper { display: flex; gap: 1rem; margin-bottom: 1rem; } .gittree-container input[type=text], .gittree-container input[type=number] { padding: 0.8rem 1rem; font-size: 1rem; border: 1px solid #d2d2d7; border-radius: 10px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; background-color: #fff; color: #1d1d1f; transition: border-color 0.2s, box-shadow 0.2s; } .gittree-container input[type=text] { flex-grow: 1; } .gittree-container input[type=text]:focus, .gittree-container input[type=number]:focus { border-color: #007aff; box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2); outline: 0; } .gittree-container button#gittree-generateBtn { padding: 0.8rem 1.5rem; font-size: 1rem; font-weight: 600; color: #fff; background-color: #007aff; border: none; border-radius: 10px; cursor: pointer; transition: background-color 0.2s, transform 0.1s; display: flex; align-items: center; justify-content: center; white-space: nowrap; } .gittree-container button#gittree-generateBtn:hover { background-color: #0071e3; } .gittree-container button#gittree-generateBtn:active { transform: scale(0.98); } .gittree-container button#gittree-generateBtn:disabled { background-color: #a0a0a0; cursor: not-allowed; opacity: 0.8; } .gittree-container .spinner { border: 2px solid rgba(255, 255, 255, 0.2); border-radius: 50%; border-top-color: #fff; width: 16px; height: 16px; animation: spin 1s linear infinite; margin-right: 0.5rem; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .gittree-container .options-row { display: flex; gap: 1rem; margin-top: 1rem; align-items: center; } .gittree-container .lang-toggle { display: flex; align-items: center; background-color: #f6f8fa; border-radius: 20px; padding: 4px; cursor: pointer; user-select: none; } .gittree-container .lang-option { padding: 6px 12px; border-radius: 16px; font-size: 0.85rem; font-weight: 500; color: #6e6e73; transition: all 0.2s; } .gittree-container .lang-option.active { background-color: #fff; color: #1d1d1f; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } .gittree-container .advanced-options { margin-left: auto; } .gittree-container .advanced-options summary { cursor: pointer; color: #6e6e73; font-size: 0.9rem; font-weight: 500; list-style-position: expert; display: inline-block; padding: 0.25rem 0.5rem; border-radius: 6px; } .gittree-container .advanced-options summary:hover { background-color: #f0f0f0; } .gittree-container .advanced-options-grid { display: grid; grid-template-columns: 1fr auto; gap: 1rem; margin-top: 0.75rem; align-items: center; } .gittree-container .advanced-options label { color: #6e6e73; font-size: 0.9rem; } .gittree-container input#gittree-depthInput { width: 70px; text-align: center; } .gittree-container input#gittree-excludeInput { width: 100%; box-sizing: border-box; } .gittree-container .result-wrapper { margin-top: 2rem; border: 1px solid #d2d2d7; border-radius: 12px; overflow: hidden; } .gittree-container .result-header { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem; background-color: #f0f0f0; border-bottom: 1px solid #d2d2d7; } .gittree-container .header-group { display: flex; align-items: center; gap: 0.5rem; } .gittree-container .header-group button { background: none; border: none; padding: 0.3rem 0.5rem; cursor: pointer; color: #6e6e73; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-size: 0.8rem; display: flex; align-items: center; gap: 0.3rem; border-radius: 6px; transition: background-color 0.2s, color 0.2s; } .gittree-container .header-group button:hover { background-color: #e0e0e0; color: #1d1d1f; } .gittree-container .header-group button svg { width: 18px; height: 18px; stroke-width: 1.8; } .gittree-container .view-modes button.active { color: #007aff; background-color: rgba(0, 122, 255, 0.15); } .gittree-container .header-group button:disabled { opacity: 0.5; cursor: not-allowed; } .gittree-container #gittree-copyBtn .copy-icon { width: 1em; height: 1em; stroke-width: 2; vertical-align: middle; } #gittree-image-card-container { position: absolute; left: -9999px; top: -9999px; padding: 4rem; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); } #gittree-image-card-container .macos-window { width: 800px; background-color: #2e2e2e; border-radius: 10px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4); padding-bottom: 20px; border: 1px solid #444; } #gittree-image-card-container .title-bar { height: 48px; display: flex; align-items: center; justify-content: center; position: relative; padding: 0 15px; border-bottom: 1px solid #404040; } #gittree-image-card-container .traffic-lights { position: absolute; left: 15px; display: flex; gap: 8px; } #gittree-image-card-container .light { width: 12px; height: 12px; border-radius: 50%; } #gittree-image-card-container .light.red { background-color: #ff5f56; } #gittree-image-card-container .light.yellow { background-color: #ffbd2e; } #gittree-image-card-container .light.green { background-color: #27c93f; } #gittree-image-card-container .title-text { color: #b0b0b0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-size: 14px; font-weight: 500; } #gittree-image-card-container .card-content { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14px; color: #e0e0e0; white-space: pre; padding: 20px; max-height: 80vh; overflow: auto; line-height: 1.6; } /* 样式选择器 */ .gittree-style-selector { margin-top: 1rem; margin-bottom: 1rem; } .gittree-style-selector label { display: block; margin-bottom: 0.5rem; color: #6e6e73; font-size: 0.9rem; } .gittree-style-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; } .gittree-style-option { border: 2px solid #d2d2d7; border-radius: 10px; padding: 1rem; cursor: pointer; transition: all 0.2s; background-color: #fff; display: flex; flex-direction: column; } .gittree-style-option:hover { border-color: #007aff; box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1); } .gittree-style-option.selected { border-color: #007aff; background-color: rgba(0, 122, 255, 0.05); } .gittree-style-option h4 { margin: 0 0 0.5rem 0; font-size: 1rem; color: #1d1d1f; } .gittree-style-option p { margin: 0; font-size: 0.85rem; color: #6e6e73; flex-grow: 1; } .gittree-style-option .preview { height: 100px; background-color: #f6f8fa; border-radius: 6px; margin-top: 0.5rem; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: #586069; } /* GitHub项目分享卡片样式 - macOS风格 */ #gittree-repo-card-container { position: absolute; left: -9999px; top: -9999px; width: 800px; background-color: #fff; border-radius: 12px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15); overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; } #gittree-repo-card-container.macos-style { background-color: #1e1e1e; border-radius: 16px; box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.5); border: 1px solid #333; } #gittree-repo-card-container.macos-style .card-header { background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%); padding: 28px; color: white; position: relative; border-bottom: 1px solid #333; } #gittree-repo-card-container.macos-style .card-header::before { content: ''; position: absolute; top: 15px; left: 15px; display: flex; gap: 8px; } #gittree-repo-card-container.macos-style .card-header::before .light { width: 12px; height: 12px; border-radius: 50%; display: inline-block; } #gittree-repo-card-container.macos-style .card-header::before .light.red { background-color: #ff5f56; } #gittree-repo-card-container.macos-style .card-header::before .light.yellow { background-color: #ffbd2e; } #gittree-repo-card-container.macos-style .card-header::before .light.green { background-color: #27c93f; } #gittree-repo-card-container.macos-style .repo-title { font-size: 26px; font-weight: 700; margin: 0 0 12px 0; display: flex; align-items: center; justify-content: center; color: #fff; } #gittree-repo-card-container.macos-style .repo-title .github-icon { width: 30px; height: 30px; margin-right: 12px; fill: white; } #gittree-repo-card-container.macos-style .repo-description { font-size: 16px; font-weight: 400; margin: 0; opacity: 0.9; line-height: 1.5; text-align: center; color: #e0e0e0; } #gittree-repo-card-container.macos-style .card-body { display: flex; padding: 28px; background-color: #1e1e1e; color: #e0e0e0; } #gittree-repo-card-container.macos-style .repo-info { flex: 1; } #gittree-repo-card-container.macos-style .repo-stats { display: flex; margin-bottom: 24px; gap: 24px; } #gittree-repo-card-container.macos-style .stat-item { display: flex; align-items: center; font-size: 18px; color: #e0e0e0; } #gittree-repo-card-container.macos-style .stat-item svg { width: 22px; height: 22px; margin-right: 8px; fill: #b0b0b0; } #gittree-repo-card-container.macos-style .repo-languages { margin-bottom: 24px; } #gittree-repo-card-container.macos-style .repo-languages h3 { font-size: 18px; margin: 0 0 12px 0; color: #e0e0e0; } #gittree-repo-card-container.macos-style .language-list { display: flex; flex-wrap: wrap; gap: 10px; } #gittree-repo-card-container.macos-style .language-item { display: flex; align-items: center; background-color: #2a2a2a; border-radius: 20px; padding: 6px 14px; font-size: 14px; color: #e0e0e0; border: 1px solid #333; } #gittree-repo-card-container.macos-style .language-color { width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; } #gittree-repo-card-container.macos-style .qr-code { width: 160px; height: 160px; background-color: white; border: 1px solid #333; border-radius: 12px; padding: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); } #gittree-repo-card-container.macos-style .qr-code canvas { max-width: 100%; max-height: 100%; } #gittree-repo-card-container.macos-style .card-footer { background-color: #2a2a2a; padding: 16px 28px; border-top: 1px solid #333; display: flex; justify-content: space-between; align-items: center; } #gittree-repo-card-container.macos-style .generated-at { font-size: 12px; color: #b0b0b0; } #gittree-repo-card-container.macos-style .watermark { font-size: 12px; color: #b0b0b0; display: flex; align-items: center; } #gittree-repo-card-container.macos-style .watermark svg { width: 16px; height: 16px; margin-right: 4px; fill: #b0b0b0; } /* GitHub项目分享卡片样式 - 现代简约风格 */ #gittree-repo-card-container.modern-style { background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%); border-radius: 20px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); overflow: hidden; border: none; } #gittree-repo-card-container.modern-style .card-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 32px; color: white; text-align: center; position: relative; overflow: hidden; } #gittree-repo-card-container.modern-style .card-header::after { content: ''; position: absolute; top: -50%; right: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%); transform: rotate(30deg); } #gittree-repo-card-container.modern-style .repo-title { font-size: 32px; font-weight: 700; margin: 0 0 14px 0; letter-spacing: -0.5px; position: relative; z-index: 1; } #gittree-repo-card-container.modern-style .repo-title .github-icon { display: none; } #gittree-repo-card-container.modern-style .repo-description { font-size: 18px; font-weight: 400; margin: 0; opacity: 0.95; line-height: 1.5; max-width: 80%; margin: 0 auto; position: relative; z-index: 1; } #gittree-repo-card-container.modern-style .card-body { display: flex; flex-direction: column; align-items: center; padding: 32px; } #gittree-repo-card-container.modern-style .repo-info { width: 100%; margin-bottom: 24px; } #gittree-repo-card-container.modern-style .repo-stats { display: flex; justify-content: center; margin-bottom: 28px; gap: 40px; } #gittree-repo-card-container.modern-style .stat-item { display: flex; flex-direction: column; align-items: center; font-size: 16px; color: #24292e; } #gittree-repo-card-container.modern-style .stat-item svg { width: 28px; height: 28px; margin-bottom: 10px; fill: #667eea; } #gittree-repo-card-container.modern-style .stat-value { font-size: 28px; font-weight: 700; color: #667eea; } #gittree-repo-card-container.modern-style .stat-label { font-size: 14px; color: #6e6e73; margin-top: 4px; } #gittree-repo-card-container.modern-style .repo-languages { width: 100%; margin-bottom: 28px; } #gittree-repo-card-container.modern-style .repo-languages h3 { font-size: 20px; margin: 0 0 16px 0; color: #24292e; text-align: center; font-weight: 600; } #gittree-repo-card-container.modern-style .language-list { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; } #gittree-repo-card-container.modern-style .language-item { display: flex; align-items: center; background-color: white; border-radius: 24px; padding: 8px 16px; font-size: 14px; color: #24292e; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); transition: transform 0.2s, box-shadow 0.2s; } #gittree-repo-card-container.modern-style .language-item:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); } #gittree-repo-card-container.modern-style .language-color { width: 16px; height: 16px; border-radius: 50%; margin-right: 8px; } #gittree-repo-card-container.modern-style .qr-code { width: 150px; height: 150px; background-color: white; border-radius: 16px; padding: 14px; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); transition: transform 0.2s, box-shadow 0.2s; } #gittree-repo-card-container.modern-style .qr-code:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15); } #gittree-repo-card-container.modern-style .qr-code canvas { max-width: 100%; max-height: 100%; } #gittree-repo-card-container.modern-style .card-footer { background-color: rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px); padding: 18px 32px; border-top: 1px solid rgba(0, 0, 0, 0.05); display: flex; justify-content: space-between; align-items: center; } #gittree-repo-card-container.modern-style .generated-at { font-size: 12px; color: #6e6e73; } #gittree-repo-card-container.modern-style .watermark { font-size: 12px; color: #6e6e73; display: flex; align-items: center; font-weight: 500; } #gittree-repo-card-container.modern-style .watermark svg { width: 16px; height: 16px; margin-right: 4px; fill: #667eea; } /* GitHub项目分享卡片样式 - GitHub风格 */ #gittree-repo-card-container.github-style { background-color: #fff; border-radius: 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1); border: 1px solid #e1e4e8; } #gittree-repo-card-container.github-style .card-header { background-color: #24292e; padding: 20px; color: white; border-bottom: 1px solid #e1e4e8; } #gittree-repo-card-container.github-style .repo-title { font-size: 22px; font-weight: 600; margin: 0; display: flex; align-items: center; } #gittree-repo-card-container.github-style .repo-title .github-icon { width: 26px; height: 26px; margin-right: 10px; fill: white; } #gittree-repo-card-container.github-style .repo-description { font-size: 15px; font-weight: 400; margin: 10px 0 0 0; opacity: 0.9; line-height: 1.5; } #gittree-repo-card-container.github-style .card-body { display: flex; padding: 20px; } #gittree-repo-card-container.github-style .repo-info { flex: 1; } #gittree-repo-card-container.github-style .repo-stats { display: flex; margin-bottom: 20px; gap: 20px; } #gittree-repo-card-container.github-style .stat-item { display: flex; align-items: center; font-size: 15px; color: #586069; } #gittree-repo-card-container.github-style .stat-item svg { width: 18px; height: 18px; margin-right: 6px; fill: #586069; } #gittree-repo-card-container.github-style .repo-languages { margin-bottom: 20px; } #gittree-repo-card-container.github-style .repo-languages h3 { font-size: 16px; margin: 0 0 10px 0; color: #24292e; font-weight: 600; } #gittree-repo-card-container.github-style .language-list { display: flex; flex-wrap: wrap; gap: 8px; } #gittree-repo-card-container.github-style .language-item { display: flex; align-items: center; background-color: #f1f8ff; border-radius: 16px; padding: 4px 12px; font-size: 13px; color: #0366d6; transition: background-color 0.2s; } #gittree-repo-card-container.github-style .language-item:hover { background-color: #e6f3ff; } #gittree-repo-card-container.github-style .language-color { width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; } #gittree-repo-card-container.github-style .qr-code { width: 130px; height: 130px; background-color: white; border: 1px solid #e1e4e8; border-radius: 8px; padding: 10px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } #gittree-repo-card-container.github-style .qr-code canvas { max-width: 100%; max-height: 100%; } #gittree-repo-card-container.github-style .card-footer { background-color: #f6f8fa; padding: 14px 20px; border-top: 1px solid #e1e4e8; display: flex; justify-content: space-between; align-items: center; } #gittree-repo-card-container.github-style .generated-at { font-size: 12px; color: #586069; } #gittree-repo-card-container.github-style .watermark { font-size: 12px; color: #586069; display: flex; align-items: center; } #gittree-repo-card-container.github-style .watermark svg { width: 16px; height: 16px; margin-right: 4px; fill: #586069; } /* GitHub项目分享卡片样式 - Material Design风格 */ #gittree-repo-card-container.material-style { background-color: #fff; border-radius: 16px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05); overflow: hidden; border: none; font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; } #gittree-repo-card-container.material-style .card-header { background-color: #4285f4; padding: 24px 24px 32px; color: white; position: relative; } #gittree-repo-card-container.material-style .card-header::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 40px; background: linear-gradient(to bottom, rgba(66, 133, 244, 0), rgba(66, 133, 244, 0.1)); } #gittree-repo-card-container.material-style .repo-title { font-size: 28px; font-weight: 500; margin: 0 0 12px 0; display: flex; align-items: center; } #gittree-repo-card-container.material-style .repo-title .github-icon { width: 32px; height: 32px; margin-right: 12px; fill: white; } #gittree-repo-card-container.material-style .repo-description { font-size: 16px; font-weight: 400; margin: 0; opacity: 0.9; line-height: 1.5; } #gittree-repo-card-container.material-style .card-body { display: flex; padding: 24px; background-color: #fff; } #gittree-repo-card-container.material-style .repo-info { flex: 1; padding-right: 24px; } #gittree-repo-card-container.material-style .repo-stats { display: flex; margin-bottom: 24px; gap: 24px; } #gittree-repo-card-container.material-style .stat-item { display: flex; align-items: center; font-size: 16px; color: #5f6368; } #gittree-repo-card-container.material-style .stat-item svg { width: 22px; height: 22px; margin-right: 8px; fill: #5f6368; } #gittree-repo-card-container.material-style .repo-languages { margin-bottom: 24px; } #gittree-repo-card-container.material-style .repo-languages h3 { font-size: 18px; margin: 0 0 12px 0; color: #202124; font-weight: 500; } #gittree-repo-card-container.material-style .language-list { display: flex; flex-wrap: wrap; gap: 10px; } #gittree-repo-card-container.material-style .language-item { display: flex; align-items: center; background-color: #f1f3f4; border-radius: 16px; padding: 6px 14px; font-size: 14px; color: #202124; transition: background-color 0.2s; } #gittree-repo-card-container.material-style .language-item:hover { background-color: #e8eaed; } #gittree-repo-card-container.material-style .language-color { width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; } #gittree-repo-card-container.material-style .qr-code { width: 140px; height: 140px; background-color: white; border-radius: 8px; padding: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); border: 1px solid #dadce0; } #gittree-repo-card-container.material-style .qr-code canvas { max-width: 100%; max-height: 100%; } #gittree-repo-card-container.material-style .card-footer { background-color: #f8f9fa; padding: 16px 24px; border-top: 1px solid #dadce0; display: flex; justify-content: space-between; align-items: center; } #gittree-repo-card-container.material-style .generated-at { font-size: 12px; color: #5f6368; } #gittree-repo-card-container.material-style .watermark { font-size: 12px; color: #5f6368; display: flex; align-items: center; } #gittree-repo-card-container.material-style .watermark svg { width: 16px; height: 16px; margin-right: 4px; fill: #5f6368; } @media (max-width: 768px) { .gittree-container { padding: 1.5rem; border: none; border-radius: 0; box-shadow: none; background-color: #f3f3f8; } .gittree-container h1 { font-size: 1.5rem; } .gittree-container .subtitle { font-size: 0.9rem; margin-bottom: 2rem; } .gittree-container .input-wrapper { flex-direction: column; } .gittree-container button#gittree-generateBtn { padding: 1rem; } .gittree-container .options-row { flex-direction: column; align-items: stretch; } .gittree-container .advanced-options { margin-left: 0; margin-top: 1rem; } .gittree-container .advanced-options-grid { grid-template-columns: 1fr; gap: 0.5rem; } .gittree-container .advanced-options-grid label[for="gittree-depthInput"] { margin-top: 0.5rem; } .gittree-container .result-header { flex-direction: column; align-items: stretch; gap: 0.75rem; } .gittree-container .header-group { justify-content: space-around; } .gittree-container .export-tools button span { display: none; } .gittree-container .export-tools button { padding: 0.5rem; } .gittree-style-options { grid-template-columns: 1fr; } } .gittree-container footer { text-align: center; margin-top: 3rem; padding-bottom: 1rem; color: #6e6e73; font-size: 0.875rem; } .gittree-container footer a { color: #1d1d1f; text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 0.3rem; } .gittree-container footer a:hover { color: #007aff; text-decoration: underline; } .gittree-container footer .github-icon { width: 1em; height: 1em; fill: currentColor; } .gittree-container footer p { margin: 0.5rem 0 0; } /* 使用说明样式 */ .gittree-instructions { margin-top: 1rem; border: 1px solid #d2d2d7; border-radius: 8px; padding: 0.5rem; } .gittree-instructions summary { cursor: pointer; font-weight: 500; color: #24292e; padding: 0.5rem; border-radius: 6px; transition: background-color 0.2s; } .gittree-instructions summary:hover { background-color: #f6f8fa; } .gittree-instructions-content { padding: 1rem; border-top: 1px solid #d2d2d7; margin-top: 0.5rem; text-align: left; } .gittree-instructions-content h3 { margin-top: 0; margin-bottom: 0.5rem; color: #24292e; font-size: 1rem; } .gittree-instructions-content ol, .gittree-instructions-content ul { margin-bottom: 1rem; padding-left: 1.5rem; } .gittree-instructions-content li { margin-bottom: 0.3rem; line-height: 1.5; } .gittree-instructions-content .lang-section { margin-bottom: 1.5rem; } .gittree-instructions-content .lang-section:last-child { margin-bottom: 0; } .gittree-instructions-content .lang-divider { border-top: 1px dashed #d2d2d7; margin: 1rem 0; padding-top: 1rem; } `); function addGitTreeButton() { const actionsContainer = document.querySelector('.pagehead-actions'); if (!actionsContainer) return; const gitTreeBtn = document.createElement('button'); gitTreeBtn.className = 'gittree-btn'; gitTreeBtn.textContent = 'Generate Tree'; gitTreeBtn.addEventListener('click', showGitTreeModal); actionsContainer.appendChild(gitTreeBtn); } function showGitTreeModal() { const currentRepoUrl = window.location.href; const modal = document.createElement('div'); modal.className = 'gittree-modal'; const modalContent = document.createElement('div'); modalContent.className = 'gittree-modal-content'; const closeBtn = document.createElement('button'); closeBtn.className = 'gittree-close-btn'; closeBtn.innerHTML = '×'; closeBtn.addEventListener('click', () => { document.body.removeChild(modal); }); const gitTreeContainer = document.createElement('div'); gitTreeContainer.className = 'gittree-container'; gitTreeContainer.innerHTML = `
Generate, filter, and share a clean directory tree for any public GitHub repo.
Generated tree will be displayed here...
Repository description will be displayed here.