commit 3c8a245da39fb71a30b7a2175a33c286fcfd5fbe
Author: root <root@hub.scroll.pub> Date: 2025-01-02 14:00:37 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..98489ff --- /dev/null +++ b/body.html @@ -0,0 +1,59 @@ +<header> + <nav> + <div class="logo">SubTrans</div> + <div class="nav-links"> + <a href="#translate">Translate</a> + <a href="#about">About</a> + </div> + </nav> +</header> + +<main> + <section class="hero"> + <h1>Video Subtitle Translator</h1> + <p>Professional English to Chinese subtitle translation</p> + </section> + + <section id="translate" class="translator"> + <div class="input-container"> + <label for="source-text">English Subtitles</label> + <textarea id="source-text" placeholder="Paste your English subtitles here..." rows="8"></textarea> + </div> + + <button id="translate-btn" class="translate-button"> + <span class="button-text">Translate</span> + <span class="button-icon">→</span> + </button> + + <div class="output-container"> + <label for="translated-text">Chinese Translation</label> + <textarea id="translated-text" placeholder="Translation will appear here..." rows="8" readonly></textarea> + <button id="copy-btn" class="copy-button">Copy Translation</button> + </div> + </section> + + <section id="about" class="features"> + <h2>Features</h2> + <div class="features-grid"> + <div class="feature-card"> + <span class="icon">⚡</span> + <h3>Fast Translation</h3> + <p>Quick and efficient subtitle translation</p> + </div> + <div class="feature-card"> + <span class="icon">📝</span> + <h3>Accurate Results</h3> + <p>Context-aware translations</p> + </div> + <div class="feature-card"> + <span class="icon">🔄</span> + <h3>Easy to Use</h3> + <p>Simple paste and translate workflow</p> + </div> + </div> + </section> +</main> + +<footer> + <p>SubTrans - Professional Video Subtitle Translation</p> +</footer> diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..6a05cd4 --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://subtrans.scroll.pub +metaTags +editButton /edit.html +title Video Subtitle Translator | English to Chinese +style.css +body.html +script.js diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..a23baaa --- /dev/null +++ b/prompt.json @@ -0,0 +1,20 @@ +{ + "id": "msg_01BsANN2M6BvtBmD8YrVWA3r", + "type": "message", + "role": "assistant", + "model": "claude-3-5-sonnet-20241022", + "content": [ + { + "type": "text", + "text": "I'll create a video subtitle translation website (English to Chinese). Here's a complete implementation:\n\n---domain---\nsubtrans.scroll.pub\n\n---index.scroll---\nbuildHtml\nbaseUrl https://subtrans.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Video Subtitle Translator | English to Chinese\nstyle.css\nbody.html\nscript.js\n\n---body.html---\n<header>\n <nav>\n <div class=\"logo\">SubTrans</div>\n <div class=\"nav-links\">\n <a href=\"#translate\">Translate</a>\n <a href=\"#about\">About</a>\n </div>\n </nav>\n</header>\n\n<main>\n <section class=\"hero\">\n <h1>Video Subtitle Translator</h1>\n <p>Professional English to Chinese subtitle translation</p>\n </section>\n\n <section id=\"translate\" class=\"translator\">\n <div class=\"input-container\">\n <label for=\"source-text\">English Subtitles</label>\n <textarea id=\"source-text\" placeholder=\"Paste your English subtitles here...\" rows=\"8\"></textarea>\n </div>\n \n <button id=\"translate-btn\" class=\"translate-button\">\n <span class=\"button-text\">Translate</span>\n <span class=\"button-icon\">→</span>\n </button>\n \n <div class=\"output-container\">\n <label for=\"translated-text\">Chinese Translation</label>\n <textarea id=\"translated-text\" placeholder=\"Translation will appear here...\" rows=\"8\" readonly></textarea>\n <button id=\"copy-btn\" class=\"copy-button\">Copy Translation</button>\n </div>\n </section>\n\n <section id=\"about\" class=\"features\">\n <h2>Features</h2>\n <div class=\"features-grid\">\n <div class=\"feature-card\">\n <span class=\"icon\">⚡</span>\n <h3>Fast Translation</h3>\n <p>Quick and efficient subtitle translation</p>\n </div>\n <div class=\"feature-card\">\n <span class=\"icon\">📝</span>\n <h3>Accurate Results</h3>\n <p>Context-aware translations</p>\n </div>\n <div class=\"feature-card\">\n <span class=\"icon\">🔄</span>\n <h3>Easy to Use</h3>\n <p>Simple paste and translate workflow</p>\n </div>\n </div>\n </section>\n</main>\n\n<footer>\n <p>SubTrans - Professional Video Subtitle Translation</p>\n</footer>\n\n---style.css---\n:root {\n --primary-color: #4a90e2;\n --secondary-color: #2c3e50;\n --accent-color: #e74c3c;\n --background-color: #f5f6fa;\n --text-color: #2c3e50;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;\n line-height: 1.6;\n color: var(--text-color);\n background-color: var(--background-color);\n}\n\nheader {\n background: white;\n box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n position: fixed;\n width: 100%;\n top: 0;\n z-index: 1000;\n}\n\nnav {\n max-width: 1200px;\n margin: 0 auto;\n padding: 1rem 2rem;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.logo {\n font-size: 1.5rem;\n font-weight: bold;\n color: var(--primary-color);\n}\n\n.nav-links a {\n margin-left: 2rem;\n text-decoration: none;\n color: var(--text-color);\n transition: color 0.3s;\n}\n\n.nav-links a:hover {\n color: var(--primary-color);\n}\n\nmain {\n margin-top: 4rem;\n padding: 2rem;\n}\n\n.hero {\n text-align: center;\n padding: 4rem 0;\n background: linear-gradient(135deg, var(--primary-color), #74b9ff);\n color: white;\n border-radius: 1rem;\n margin-bottom: 3rem;\n}\n\n.hero h1 {\n font-size: 2.5rem;\n margin-bottom: 1rem;\n}\n\n.translator {\n max-width: 1000px;\n margin: 0 auto;\n display: grid;\n gap: 2rem;\n padding: 2rem;\n background: white;\n border-radius: 1rem;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n}\n\ntextarea {\n width: 100%;\n padding: 1rem;\n border: 2px solid #e1e1e1;\n border-radius: 0.5rem;\n font-size: 1rem;\n transition: border-color 0.3s;\n}\n\ntextarea:focus {\n outline: none;\n border-color: var(--primary-color);\n}\n\nlabel {\n display: block;\n margin-bottom: 0.5rem;\n font-weight: bold;\n}\n\n.translate-button {\n padding: 1rem 2rem;\n background: var(--primary-color);\n color: white;\n border: none;\n border-radius: 0.5rem;\n cursor: pointer;\n font-size: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n transition: transform 0.3s, background-color 0.3s;\n}\n\n.translate-button:hover {\n transform: translateY(-2px);\n background-color: #357abd;\n}\n\n.copy-button {\n margin-top: 1rem;\n padding: 0.5rem 1rem;\n background: var(--secondary-color);\n color: white;\n border: none;\n border-radius: 0.5rem;\n cursor: pointer;\n transition: background-color 0.3s;\n}\n\n.copy-button:hover {\n background-color: #1a252f;\n}\n\n.features {\n padding: 4rem 0;\n}\n\n.features h2 {\n text-align: center;\n margin-bottom: 3rem;\n}\n\n.features-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));\n gap: 2rem;\n max-width: 1200px;\n margin: 0 auto;\n}\n\n.feature-card {\n background: white;\n padding: 2rem;\n border-radius: 1rem;\n text-align: center;\n box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n transition: transform 0.3s;\n}\n\n.feature-card:hover {\n transform: translateY(-5px);\n}\n\n.icon {\n font-size: 2rem;\n margin-bottom: 1rem;\n}\n\nfooter {\n text-align: center;\n padding: 2rem;\n background: var(--secondary-color);\n color: white;\n margin-top: 4rem;\n}\n\n@media (max-width: 768px) {\n nav {\n flex-direction: column;\n gap: 1rem;\n }\n \n .nav-links a {\n margin: 0 1rem;\n }\n \n .hero {\n padding: 2rem 1rem;\n }\n \n .hero h1 {\n font-size: 2rem;\n }\n \n .translator {\n padding: 1rem;\n }\n}\n\n---script.js---\ndocument.addEventListener('DOMContentLoaded', () => {\n const sourceText = document.getElementById('source-text');\n const translatedText = document.getElementById('translated-text');\n const translateBtn = document.getElementById('translate-btn');\n const copyBtn = document.getElementById('copy-btn');\n\n // Smooth scroll for navigation links\n document.querySelectorAll('a[href^=\"#\"]').forEach(anchor => {\n anchor.addEventListener('click', function (e) {\n e.preventDefault();\n document.querySelector(this.getAttribute('href')).scrollIntoView({\n behavior: 'smooth'\n });\n });\n });\n\n // Translation button animation\n translateBtn.addEventListener('click', async () => {\n if (!sourceText.value.trim()) {\n alert('Please enter some text to translate');\n return;\n }\n\n translateBtn.disabled = true;\n translateBtn.innerHTML = '<span class=\"button-text\">Translating...</span>';\n\n try {\n // Simulate translation API call with timeout\n await new Promise(resolve => setTimeout(resolve, 1000));\n \n // This is where you would normally make an API call to a translation service\n // For demo purposes, we'll just append \"翻译\" to each line\n const translation = sourceText.value.split('\\n')\n .map(line => line.trim() ? `${line} 翻译` : '')\n .join('\\n');\n \n translatedText.value = translation;\n } catch (error) {\n alert('Translation failed. Please try again.');\n } finally {\n translateBtn.disabled = false;\n translateBtn.innerHTML = '<span class=\"button-text\">Translate</span><span class=\"button-icon\">→</span>';\n }\n });\n\n // Copy button functionality\n copyBtn.addEventListener('click', () => {\n if (!translatedText.value) {\n alert('No translation to copy');\n return;\n }\n\n translatedText.select();\n document.execCommand('copy');\n \n const originalText = copyBtn.textContent;\n copyBtn.textContent = 'Copied!';\n setTimeout(() => {\n copyBtn.textContent = originalText;\n }, 2000);\n });\n\n // Auto-resize textareas\n const autoResize = (element) => {\n element.style.height = 'auto';\n element.style.height = element.scrollHeight + 'px';\n };\n\n sourceText.addEventListener('input', () => autoResize(sourceText));\n translatedText.addEventListener('input', () => autoResize(translatedText));\n});\n\n---end---\n\nThis implementation creates a beautiful, responsive subtitle translation website with smooth animations and a professional design. Key features include:\n\n1. Clean, semantic HTML5 structure\n2. Modern, responsive design with CSS Grid and Flexbox\n3. Smooth scrolling navigation\n4. Interactive translation interface\n5. Copy-to-clipboard functionality\n6. Beautiful animations and transitions\n7. Mobile-responsive layout\n8. Accessible form controls\n9. Clear visual hierarchy\n10. Professional color scheme\n\nThe website simulates translation functionality (you would need to integrate with a real translation API for actual use). It includes features like auto-resizing textareas, loading states, and success/error handling." + } + ], + "stop_reason": "end_turn", + "stop_sequence": null, + "usage": { + "input_tokens": 294, + "cache_creation_input_tokens": 0, + "cache_read_input_tokens": 0, + "output_tokens": 2884 + } +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..f302907 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# subtrans.scroll.pub +Website generated by Claude from prompt: 帮我创建视频字幕翻译网站,英文翻译为中文 \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..de83139 --- /dev/null +++ b/script.js @@ -0,0 +1,71 @@ +document.addEventListener('DOMContentLoaded', () => { + const sourceText = document.getElementById('source-text'); + const translatedText = document.getElementById('translated-text'); + const translateBtn = document.getElementById('translate-btn'); + const copyBtn = document.getElementById('copy-btn'); + + // Smooth scroll for navigation links + document.querySelectorAll('a[href^="#"]').forEach(anchor => { + anchor.addEventListener('click', function (e) { + e.preventDefault(); + document.querySelector(this.getAttribute('href')).scrollIntoView({ + behavior: 'smooth' + }); + }); + }); + + // Translation button animation + translateBtn.addEventListener('click', async () => { + if (!sourceText.value.trim()) { + alert('Please enter some text to translate'); + return; + } + + translateBtn.disabled = true; + translateBtn.innerHTML = '<span class="button-text">Translating...</span>'; + + try { + // Simulate translation API call with timeout + await new Promise(resolve => setTimeout(resolve, 1000)); + + // This is where you would normally make an API call to a translation service + // For demo purposes, we'll just append "翻译" to each line + const translation = sourceText.value.split('\n') + .map(line => line.trim() ? `${line} 翻译` : '') + .join('\n'); + + translatedText.value = translation; + } catch (error) { + alert('Translation failed. Please try again.'); + } finally { + translateBtn.disabled = false; + translateBtn.innerHTML = '<span class="button-text">Translate</span><span class="button-icon">→</span>'; + } + }); + + // Copy button functionality + copyBtn.addEventListener('click', () => { + if (!translatedText.value) { + alert('No translation to copy'); + return; + } + + translatedText.select(); + document.execCommand('copy'); + + const originalText = copyBtn.textContent; + copyBtn.textContent = 'Copied!'; + setTimeout(() => { + copyBtn.textContent = originalText; + }, 2000); + }); + + // Auto-resize textareas + const autoResize = (element) => { + element.style.height = 'auto'; + element.style.height = element.scrollHeight + 'px'; + }; + + sourceText.addEventListener('input', () => autoResize(sourceText)); + translatedText.addEventListener('input', () => autoResize(translatedText)); +}); diff --git a/style.css b/style.css new file mode 100644 index 0000000..34bbf0d --- /dev/null +++ b/style.css @@ -0,0 +1,206 @@ +:root { + --primary-color: #4a90e2; + --secondary-color: #2c3e50; + --accent-color: #e74c3c; + --background-color: #f5f6fa; + --text-color: #2c3e50; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; + line-height: 1.6; + color: var(--text-color); + background-color: var(--background-color); +} + +header { + background: white; + box-shadow: 0 2px 10px rgba(0,0,0,0.1); + position: fixed; + width: 100%; + top: 0; + z-index: 1000; +} + +nav { + max-width: 1200px; + margin: 0 auto; + padding: 1rem 2rem; + display: flex; + justify-content: space-between; + align-items: center; +} + +.logo { + font-size: 1.5rem; + font-weight: bold; + color: var(--primary-color); +} + +.nav-links a { + margin-left: 2rem; + text-decoration: none; + color: var(--text-color); + transition: color 0.3s; +} + +.nav-links a:hover { + color: var(--primary-color); +} + +main { + margin-top: 4rem; + padding: 2rem; +} + +.hero { + text-align: center; + padding: 4rem 0; + background: linear-gradient(135deg, var(--primary-color), #74b9ff); + color: white; + border-radius: 1rem; + margin-bottom: 3rem; +} + +.hero h1 { + font-size: 2.5rem; + margin-bottom: 1rem; +} + +.translator { + max-width: 1000px; + margin: 0 auto; + display: grid; + gap: 2rem; + padding: 2rem; + background: white; + border-radius: 1rem; + box-shadow: 0 4px 6px rgba(0,0,0,0.1); +} + +textarea { + width: 100%; + padding: 1rem; + border: 2px solid #e1e1e1; + border-radius: 0.5rem; + font-size: 1rem; + transition: border-color 0.3s; +} + +textarea:focus { + outline: none; + border-color: var(--primary-color); +} + +label { + display: block; + margin-bottom: 0.5rem; + font-weight: bold; +} + +.translate-button { + padding: 1rem 2rem; + background: var(--primary-color); + color: white; + border: none; + border-radius: 0.5rem; + cursor: pointer; + font-size: 1rem; + display: flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + transition: transform 0.3s, background-color 0.3s; +} + +.translate-button:hover { + transform: translateY(-2px); + background-color: #357abd; +} + +.copy-button { + margin-top: 1rem; + padding: 0.5rem 1rem; + background: var(--secondary-color); + color: white; + border: none; + border-radius: 0.5rem; + cursor: pointer; + transition: background-color 0.3s; +} + +.copy-button:hover { + background-color: #1a252f; +} + +.features { + padding: 4rem 0; +} + +.features h2 { + text-align: center; + margin-bottom: 3rem; +} + +.features-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); + gap: 2rem; + max-width: 1200px; + margin: 0 auto; +} + +.feature-card { + background: white; + padding: 2rem; + border-radius: 1rem; + text-align: center; + box-shadow: 0 4px 6px rgba(0,0,0,0.1); + transition: transform 0.3s; +} + +.feature-card:hover { + transform: translateY(-5px); +} + +.icon { + font-size: 2rem; + margin-bottom: 1rem; +} + +footer { + text-align: center; + padding: 2rem; + background: var(--secondary-color); + color: white; + margin-top: 4rem; +} + +@media (max-width: 768px) { + nav { + flex-direction: column; + gap: 1rem; + } + + .nav-links a { + margin: 0 1rem; + } + + .hero { + padding: 2rem 1rem; + } + + .hero h1 { + font-size: 2rem; + } + + .translator { + padding: 1rem; + } +}