Download components/ai-explainer.js from techaman/futuroscript-visionary-tech-narrator: direct link, hf CLI and curl.
- Browser
- Download file 4.26 kB
-
https://huggingface.co/spaces/techaman/futuroscript-visionary-tech-narrator/resolve/main/components/ai-explainer.js
- Command line
-
hf download hf://spaces/techaman/futuroscript-visionary-tech-narrator/components/ai-explainer.js
-
curl -L -o ai-explainer.js https://huggingface.co/spaces/techaman/futuroscript-visionary-tech-narrator/resolve/main/components/ai-explainer.js
4.26 kB
| class AIExplainer extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| margin: 2rem 0; | |
| } | |
| .explainer-container { | |
| background: rgba(255,255,255,0.05); | |
| border-radius: 16px; | |
| padding: 1.5rem; | |
| border: 1px solid rgba(61,220,151,0.2); | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .character { | |
| display: flex; | |
| gap: 1rem; | |
| align-items: flex-start; | |
| } | |
| .avatar { | |
| width: 50px; | |
| height: 50px; | |
| border-radius: 50%; | |
| background: linear-gradient(135deg, #3ddc97, #2bc8c8); | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| flex-shrink: 0; | |
| } | |
| .avatar i { | |
| color: white; | |
| width: 24px; | |
| height: 24px; | |
| } | |
| .content { | |
| flex: 1; | |
| } | |
| .name { | |
| font-weight: 600; | |
| margin: 0 0 0.5rem 0; | |
| color: #3ddc97; | |
| } | |
| .message { | |
| margin: 0; | |
| line-height: 1.5; | |
| color: rgba(255,255,255,0.8); | |
| } | |
| .controls { | |
| display: flex; | |
| gap: 0.5rem; | |
| margin-top: 1rem; | |
| } | |
| button { | |
| background: rgba(61,220,151,0.1); | |
| border: 1px solid rgba(61,220,151,0.2); | |
| color: #3ddc97; | |
| padding: 0.5rem 1rem; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| font-size: 0.9rem; | |
| transition: all 0.2s ease; | |
| } | |
| button:hover { | |
| background: rgba(61,220,151,0.2); | |
| } | |
| .decoration { | |
| position: absolute; | |
| top: 0; | |
| right: 0; | |
| width: 100px; | |
| height: 100px; | |
| background: radial-gradient(circle, rgba(61,220,151,0.03) 0%, transparent 70%); | |
| pointer-events: none; | |
| } | |
| </style> | |
| <div class="explainer-container"> | |
| <div class="character"> | |
| <div class="avatar"> | |
| <i data-feather="cpu"></i> | |
| </div> | |
| <div class="content"> | |
| <h3 class="name">AI Guide</h3> | |
| <p class="message"> | |
| This video showcases futuristic tech gadgets in 2025. Key highlights include: | |
| AI Pocket Assistants for real-time translation, Neural Headphones adapting to brainwaves, | |
| Self-Cleaning Smart Fabric eliminating laundry needs, and Holographic Workstations replacing screens. | |
| The video follows a structured format with intro, product showcases, and engaging outro. | |
| </p> | |
| <div class="controls"> | |
| <button id="summaryBtn">Get Summary</button> | |
| <button id="transcriptBtn">Get Transcript</button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="decoration"></div> | |
| </div> | |
| `; | |
| // Initialize feather icons | |
| if (window.feather) { | |
| window.feather.replace(); | |
| } | |
| // Add button functionality | |
| this.shadowRoot.getElementById('summaryBtn').addEventListener('click', () => { | |
| this.showSummary(); | |
| }); | |
| this.shadowRoot.getElementById('transcriptBtn').addEventListener('click', () => { | |
| this.showTranscript(); | |
| }); | |
| } | |
| showSummary() { | |
| const message = this.shadowRoot.querySelector('.message'); | |
| message.textContent = "Summary: This 2:30 video presents 5 revolutionary 2025 gadgets in a tech-review format, starting with an attention-grabbing intro, followed by detailed product segments, and ending with a call-to-action for engagement. Perfect for tech enthusiasts!"; | |
| } | |
| showTranscript() { | |
| const message = this.shadowRoot.querySelector('.message'); | |
| message.textContent = "Full Transcript: [0:00-0:08] INTRO: Quick cuts of futuristic gadgets... [0:08-0:35] AI Pocket Assistant with holographic interface... [0:35-1:02] Neural Headphones with brainwave visualization... [1:02-1:45] Self-Cleaning Smart Fabric demo... [1:45-2:15] Holographic Workstation interaction... [2:15-2:30] OUTRO: Channel branding and call-to-action"; | |
| } | |
| } | |
| customElements.define('ai-explainer', AIExplainer); |