-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.html
More file actions
720 lines (635 loc) · 21.2 KB
/
Copy pathvalidate.html
File metadata and controls
720 lines (635 loc) · 21.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spark — Validate Idea</title>
<link rel="stylesheet" href="styles.css">
<style>
/* ── Validate page ── */
.validate-layout {
max-width: 900px;
margin: 0 auto;
padding: 2.5rem 2rem 5rem;
}
/* Idea picker */
.picker-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1.5rem;
margin-bottom: 2rem;
display: flex;
align-items: center;
gap: 1rem;
}
.picker-card .select-wrap { flex: 1; }
/* Scorecard header */
.score-header {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 2rem;
margin-bottom: 1.5rem;
display: grid;
grid-template-columns: 1fr auto;
gap: 1.5rem;
align-items: start;
}
.score-main h2 {
font-size: 1.6rem;
font-weight: 800;
letter-spacing: -0.03em;
margin-bottom: 0.3rem;
}
.score-main .tagline {
font-family: 'Fraunces', serif;
font-style: italic;
color: var(--text-2);
font-size: 0.9rem;
margin-bottom: 1rem;
}
.score-main .desc {
font-size: 0.8rem;
color: var(--text-2);
line-height: 1.7;
}
/* Overall score widget */
.overall-score {
text-align: center;
min-width: 120px;
}
.score-ring {
width: 100px;
height: 100px;
margin: 0 auto 0.75rem;
position: relative;
}
.score-ring svg {
transform: rotate(-90deg);
width: 100%; height: 100%;
}
.score-ring circle {
fill: none;
stroke-width: 6;
stroke-linecap: round;
}
.ring-bg { stroke: var(--border); }
.ring-fill { stroke: var(--accent); transition: stroke-dashoffset 1s cubic-bezier(0.34,1.56,0.64,1); }
.score-num {
position: absolute;
top: 50%; left: 50%;
transform: translate(-50%, -50%);
font-family: 'Syne', sans-serif;
font-weight: 800;
font-size: 1.5rem;
letter-spacing: -0.04em;
}
.score-num span { font-size: 0.7rem; color: var(--text-3); font-weight: 400; }
.score-verdict {
font-size: 0.65rem;
letter-spacing: 0.1em;
text-transform: uppercase;
margin-top: 0.25rem;
}
/* Criteria grid */
.criteria-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
margin-bottom: 1.5rem;
}
.criterion-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1.25rem;
animation: fadeUp 0.4s ease both;
}
.criterion-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 0.85rem;
gap: 0.5rem;
}
.criterion-name {
font-family: 'Syne', sans-serif;
font-size: 0.9rem;
font-weight: 700;
letter-spacing: -0.01em;
display: flex;
align-items: center;
gap: 0.5rem;
}
.criterion-icon { font-size: 1.1rem; }
.score-badge {
font-family: 'Syne', sans-serif;
font-weight: 800;
font-size: 1.2rem;
flex-shrink: 0;
padding: 0.2rem 0.5rem;
border-radius: 6px;
}
.score-hi { color: var(--green); background: var(--green-lo); }
.score-mid { color: var(--amber); background: var(--amber-lo); }
.score-low { color: var(--red); background: var(--red-lo); }
.criterion-meter { margin-bottom: 0.85rem; }
.criterion-detail {
font-size: 0.75rem;
color: var(--text-2);
line-height: 1.65;
}
.criterion-detail strong { color: var(--text); }
/* Competitor table */
.comp-table {
width: 100%;
border-collapse: collapse;
font-size: 0.75rem;
}
.comp-table th {
text-align: left;
font-size: 0.6rem;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--text-3);
padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--border);
}
.comp-table td {
padding: 0.65rem 0.75rem;
border-bottom: 1px solid rgba(255,255,255,0.03);
color: var(--text-2);
}
.comp-table tr:hover td { background: rgba(255,255,255,0.02); }
.comp-name { color: var(--text); font-weight: 400; }
.weakness-pill {
display: inline-block;
font-size: 0.6rem;
background: var(--red-lo);
color: var(--red);
border-radius: 3px;
padding: 0.15rem 0.45rem;
}
/* Verdict section */
.verdict-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1.75rem;
margin-bottom: 1rem;
}
.verdict-card h3 {
font-size: 1rem;
margin-bottom: 1rem;
}
.checklist { list-style: none; display: flex; flex-direction: column; gap: 0.65rem; }
.checklist li {
display: flex;
align-items: flex-start;
gap: 0.65rem;
font-size: 0.8rem;
color: var(--text-2);
line-height: 1.5;
}
.check-icon { font-size: 0.85rem; flex-shrink: 0; margin-top: 1px; }
/* Action buttons */
.action-row {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
margin-top: 1.5rem;
}
/* Go/No-go */
.gono-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1.75rem;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.5rem;
}
.gono-col h4 {
font-size: 0.75rem;
letter-spacing: 0.08em;
text-transform: uppercase;
margin-bottom: 0.75rem;
}
.pros-col h4 { color: var(--green); }
.cons-col h4 { color: var(--red); }
.pro-item, .con-item {
display: flex;
gap: 0.5rem;
font-size: 0.78rem;
color: var(--text-2);
line-height: 1.5;
margin-bottom: 0.5rem;
}
/* Print / share */
.share-bar {
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}
/* Responsive */
@media (max-width: 640px) {
.criteria-grid { grid-template-columns: 1fr; }
.score-header { grid-template-columns: 1fr; }
.gono-card { grid-template-columns: 1fr; }
.picker-card { flex-direction: column; align-items: stretch; }
}
</style>
</head>
<body>
<div class="bg-grid"></div>
<div class="bg-orb bg-orb-1"></div>
<div class="bg-orb bg-orb-2"></div>
<div class="app-wrapper">
<nav>
<a href="index.html" class="nav-brand">
<div class="brand-icon">⚡</div>
<span class="brand-name">Spark</span>
</a>
<div class="nav-links">
<a href="index.html" class="nav-link"><span>Generate</span></a>
<a href="saved.html" class="nav-link">
<span>Saved</span>
<span class="nav-badge" id="saved-badge" style="display:none">0</span>
</a>
<a href="validate.html" class="nav-link active"><span>Validate</span></a>
</div>
</nav>
<div class="validate-layout">
<div class="page-header" style="padding:0 0 1.5rem;margin-bottom:1.5rem;border-bottom:1px solid var(--border);">
<p class="eyebrow" style="margin-bottom:0.75rem;">Idea Validation</p>
<h1 style="font-size:2rem;">Scorecard</h1>
<p style="font-size:0.8rem;color:var(--text-2);margin-top:0.5rem;line-height:1.6;">
A structured framework to evaluate market, competition, technical, and financial viability.
</p>
</div>
<!-- Picker -->
<div class="picker-card">
<label style="margin:0;white-space:nowrap;">Evaluating:</label>
<div class="select-wrap" style="flex:1;">
<select id="idea-picker" onchange="loadIdea(this.value)">
<option value="">— Select an idea —</option>
</select>
</div>
<button class="btn btn-ghost btn-sm" onclick="saveCurrent()">♡ Save</button>
</div>
<!-- Scorecard content -->
<div id="scorecard" style="display:none;">
<!-- Header with ring score -->
<div class="score-header">
<div class="score-main">
<h2 id="sc-title"></h2>
<div class="tagline" id="sc-tagline"></div>
<div class="desc" id="sc-desc"></div>
<div style="margin-top:1rem;display:flex;gap:0.5rem;flex-wrap:wrap;" id="sc-tags"></div>
</div>
<div class="overall-score">
<div class="score-ring">
<svg viewBox="0 0 100 100">
<circle class="ring-bg" cx="50" cy="50" r="42" />
<circle class="ring-fill" id="ring-fill" cx="50" cy="50" r="42"
stroke-dasharray="263.9"
stroke-dashoffset="263.9" />
</svg>
<div class="score-num" id="ring-score">0<span>/100</span></div>
</div>
<div class="score-verdict" id="ring-verdict"></div>
</div>
</div>
<!-- Criteria -->
<div class="criteria-grid" id="criteria-grid"></div>
<!-- Go/No-go -->
<div class="gono-card" style="margin-bottom:1rem;">
<div class="gono-col pros-col">
<h4>✓ Strengths</h4>
<div id="pros-list"></div>
</div>
<div class="gono-col cons-col">
<h4>✗ Risks</h4>
<div id="cons-list"></div>
</div>
</div>
<!-- Competitive landscape -->
<div class="verdict-card" style="margin-bottom:1rem;">
<h3>Competitive Landscape</h3>
<table class="comp-table">
<thead>
<tr>
<th>Competitor</th>
<th>Their Weakness</th>
<th>Your Angle</th>
</tr>
</thead>
<tbody id="comp-tbody"></tbody>
</table>
</div>
<!-- Next Steps -->
<div class="verdict-card">
<h3>Recommended Next Steps</h3>
<ul class="checklist" id="next-steps"></ul>
<div class="action-row">
<button class="btn btn-primary" onclick="saveCurrentAndGo()">♡ Save This Idea</button>
<a href="index.html" class="btn btn-ghost" style="text-decoration:none;">← More Ideas</a>
<button class="btn btn-ghost" onclick="printCard()">⊞ Print Report</button>
</div>
</div>
</div>
<!-- Empty state -->
<div class="empty-state" id="empty-validate">
<div class="empty-icon">🔬</div>
<h3>Pick an idea to validate</h3>
<p>Select from the dropdown above, or go to Generate and click the → button on any idea card.</p>
<a href="index.html" class="btn btn-primary" style="margin-top:1rem;text-decoration:none;">← Browse Ideas</a>
</div>
</div>
</div>
<script src="app.js"></script>
<script>
// Validation criteria configs per idea
const CRITERIA_CONFIG = {
market: {
name: 'Market Opportunity',
icon: '🌍',
keys: ['marketSize', 'painScore'],
describe(idea) {
const sizeMap = { Small: 40, Medium: 65, Large: 80, Huge: 95 };
const score = Math.round((sizeMap[idea.marketSize] + idea.painScore) / 2);
return {
score,
detail: `Market size: <strong>${idea.marketSize}</strong>. Pain score: <strong>${idea.painScore}/100</strong>. ${
idea.painScore >= 90
? 'This is a deeply felt pain point — customers will pay.'
: idea.painScore >= 80
? 'Clear pain, strong pull-market dynamics.'
: 'Moderate pain; marketing will be key to educating the market.'
}`
};
}
},
competition: {
name: 'Competitive Position',
icon: '⚔️',
describe(idea) {
const nComp = idea.competitors.length;
const score = nComp <= 2 ? 85 : nComp <= 3 ? 72 : nComp <= 4 ? 60 : 48;
return {
score,
detail: `<strong>${nComp} known competitors</strong>. Your edge: ${idea.edge}. ${
score >= 80
? 'Low-competition space — early mover advantage is real.'
: score >= 65
? 'Competitive, but differentiation is achievable with the right focus.'
: 'Crowded market. Requires laser-focused niche or 10x improvement on one dimension.'
}`
};
}
},
revenue: {
name: 'Revenue Model',
icon: '💰',
describe(idea) {
const bestModels = ['subscription','api','usage'];
const hasBest = idea.models.some(m => bestModels.includes(m));
const score = hasBest ? 82 : 65;
return {
score,
detail: `Revenue model(s): <strong>${idea.models.join(', ')}</strong>. ARR potential: <strong>${idea.arr}</strong>. ${
hasBest
? 'Predictable, recurring revenue — easier to raise on and plan around.'
: 'Less predictable model; focus on LTV and payback period early.'
}`
};
}
},
technical: {
name: 'Technical Feasibility',
icon: '🛠',
describe(idea) {
const diffMap = { easy: 90, medium: 72, hard: 50 };
const score = diffMap[idea.difficulty];
return {
score,
detail: `Difficulty: <strong>${idea.difficulty}</strong>. Suggested stack: <strong>${idea.techStack.join(', ')}</strong>. MVP in ${idea.mvpWeeks[0]}–${idea.mvpWeeks[1]} weeks. ${
score >= 85
? 'Achievable solo with modern API-first stack. Ship fast, learn fast.'
: score >= 65
? 'Needs a small team or strong senior generalist. Plan for 2–3 months of focused build.'
: 'Complex. Consider raising pre-seed before building, or de-scope aggressively for v0.'
}`
};
}
},
gtm: {
name: 'Go-To-Market',
icon: '🚀',
describe(idea) {
const easyMarkets = ['smb','creators','developer','consumer'];
const easyModels = ['freemium','lifetime'];
const easyGTM = idea.market.some(m => easyMarkets.includes(m)) || idea.models.some(m => easyModels.includes(m));
const score = easyGTM ? 78 : 62;
return {
score,
detail: `Target: <strong>${idea.market.join(', ')}</strong>. ${
easyGTM
? 'Product-led growth or content marketing can drive organic sign-ups. Start with community channels and Product Hunt.'
: 'Enterprise or regulated markets require outbound + longer cycles. Budget 9–18 months for initial traction.'
}`
};
}
},
timing: {
name: 'Market Timing',
icon: '⏱',
describe(idea) {
const aiTags = ['AI','ML','Automation','API'];
const hasAI = idea.tags.some(t => aiTags.includes(t));
const score = hasAI ? 88 : 70;
return {
score,
detail: `Tags: <strong>${idea.tags.join(', ')}</strong>. ${
hasAI
? 'AI tailwinds are strong in 2025–26. Buyers are actively budgeting for AI tools — you don\'t need to justify the category.'
: 'Established market. Timing is neutral — success depends more on execution and differentiation than trend riding.'
}`
};
}
},
};
const COMP_WEAKNESSES = [
'Too expensive for SMBs',
'Poor UX, steep learning curve',
'No AI / slow to adopt AI',
'Enterprise-only, no self-serve',
'Requires professional services',
'No API / poor integrations',
'Bloated feature set',
'Long onboarding, poor time-to-value',
];
const NEXT_STEPS = [
{ icon: '🎯', text: 'Define your ICP: write a one-paragraph description of your first 10 customers.' },
{ icon: '📞', text: 'Run 20 discovery calls. Ask about current workarounds, not whether they\'d buy your tool.' },
{ icon: '🔨', text: 'Build a concierge MVP. Do things manually to validate before automating.' },
{ icon: '📊', text: 'Set up a landing page with a waitlist and run $500 in paid ads to test messaging.' },
{ icon: '💳', text: 'Get your first paid customer before building feature #2.' },
{ icon: '📝', text: 'Document the workflow your product replaces — become the expert on the pain.' },
{ icon: '🤝', text: 'Find one design partner willing to give weekly feedback in exchange for a free year.' },
];
let currentIdeaId = null;
function init() {
// Populate picker
const picker = document.getElementById('idea-picker');
IDEAS.forEach(idea => {
const opt = document.createElement('option');
opt.value = idea.id;
opt.textContent = idea.title;
picker.appendChild(opt);
});
// Check URL param
const params = new URLSearchParams(location.search);
const id = params.get('id');
if (id) {
picker.value = id;
loadIdea(id);
}
}
function loadIdea(id) {
if (!id) {
document.getElementById('scorecard').style.display = 'none';
document.getElementById('empty-validate').style.display = '';
return;
}
const idea = getIdea(id);
if (!idea) return;
currentIdeaId = id;
document.getElementById('scorecard').style.display = '';
document.getElementById('empty-validate').style.display = 'none';
// Update URL
history.replaceState(null, '', '?id=' + id);
// Header
document.getElementById('sc-title').textContent = idea.title;
document.getElementById('sc-tagline').textContent = `"${idea.tagline}"`;
document.getElementById('sc-desc').textContent = idea.desc;
const diff = getDiffTag(idea.difficulty);
document.getElementById('sc-tags').innerHTML =
`<span class="tag ${diff.cls}">${diff.label}</span>` +
`<span class="tag tag-amber">${idea.revenueRange}</span>` +
idea.tags.map(t => `<span class="tag tag-gray">${t}</span>`).join('');
// Build criteria
const keys = Object.keys(CRITERIA_CONFIG);
let totalScore = 0;
const results = keys.map(k => {
const cfg = CRITERIA_CONFIG[k];
const { score, detail } = cfg.describe(idea);
totalScore += score;
return { key: k, cfg, score, detail };
});
const overall = Math.round(totalScore / keys.length);
// Ring animation
setTimeout(() => {
const circ = 263.9;
const offset = circ - (overall / 100) * circ;
document.getElementById('ring-fill').style.strokeDashoffset = offset;
animateNum('ring-score', 0, overall, 900);
// Verdict
const verdict = overall >= 80 ? '🟢 Strong Opportunity' : overall >= 65 ? '🟡 Promising' : '🔴 Needs Work';
const verdictColor = overall >= 80 ? 'var(--green)' : overall >= 65 ? 'var(--amber)' : 'var(--red)';
const vEl = document.getElementById('ring-verdict');
vEl.textContent = verdict;
vEl.style.color = verdictColor;
const ringFill = document.getElementById('ring-fill');
ringFill.style.stroke = verdictColor;
}, 100);
// Criteria cards
document.getElementById('criteria-grid').innerHTML = results.map((r, i) => {
const scoreClass = r.score >= 80 ? 'score-hi' : r.score >= 65 ? 'score-mid' : 'score-low';
const meterClass = r.score >= 80 ? 'meter-green' : r.score >= 65 ? 'meter-amber' : 'meter-red';
return `
<div class="criterion-card" style="animation-delay:${i*0.08}s">
<div class="criterion-header">
<div class="criterion-name">
<span class="criterion-icon">${r.cfg.icon}</span>
${r.cfg.name}
</div>
<span class="score-badge ${scoreClass}">${r.score}</span>
</div>
<div class="criterion-meter">
<div class="meter-track">
<div class="meter-fill ${meterClass}" style="width:0%" data-target="${r.score}"></div>
</div>
</div>
<div class="criterion-detail">${r.detail}</div>
</div>`;
}).join('');
// Animate meter bars
setTimeout(() => {
document.querySelectorAll('.meter-fill[data-target]').forEach(el => {
el.style.transition = 'width 1s cubic-bezier(0.34,1.56,0.64,1)';
el.style.width = el.dataset.target + '%';
});
}, 200);
// Pros / cons
const pros = [
`Clear pain: ${idea.painScore}/100 pain score among target buyers`,
`ARR potential: ${idea.arr} at scale`,
`${idea.difficulty === 'easy' ? 'Solo-buildable' : idea.difficulty === 'medium' ? 'Small team can execute' : 'Defensible with capital'} — ${idea.mvpWeeks[0]}–${idea.mvpWeeks[1]} week MVP`,
`Competitive edge: ${idea.edge}`,
];
const cons = [
idea.competitors.length >= 4 ? `${idea.competitors.length} established competitors to displace` : `Competition from ${idea.competitors[0]} and others`,
idea.difficulty === 'hard' ? 'Long build cycle; requires significant capital or founding team' : idea.models.includes('freemium') ? 'Freemium increases CAC before revenue conversion' : 'Need to define sales motion (PLG vs. outbound) early',
idea.market.includes('enterprise') ? 'Long sales cycles; budget for 9–18 months before stable revenue' : 'Market education may be required to drive urgency',
];
document.getElementById('pros-list').innerHTML = pros.map(p => `<div class="pro-item"><span>✓</span><span>${p}</span></div>`).join('');
document.getElementById('cons-list').innerHTML = cons.map(c => `<div class="con-item"><span>✗</span><span>${c}</span></div>`).join('');
// Competitors
document.getElementById('comp-tbody').innerHTML = idea.competitors.map((comp, i) => `
<tr>
<td class="comp-name">${comp}</td>
<td><span class="weakness-pill">${COMP_WEAKNESSES[i % COMP_WEAKNESSES.length]}</span></td>
<td style="font-size:0.72rem;color:var(--text-2);">${idea.edge.split(',')[0] || 'Focused niche'}</td>
</tr>`).join('');
// Next steps
const steps = shuffle(NEXT_STEPS).slice(0, 5);
document.getElementById('next-steps').innerHTML = steps.map(s =>
`<li><span class="check-icon">${s.icon}</span><span>${s.text}</span></li>`
).join('');
}
function animateNum(elId, from, to, duration) {
const el = document.getElementById(elId);
const start = performance.now();
function frame(now) {
const p = Math.min((now - start) / duration, 1);
const val = Math.round(from + (to - from) * p);
el.innerHTML = val + '<span>/100</span>';
if (p < 1) requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
}
function saveCurrent() {
if (!currentIdeaId) return;
const idea = getIdea(currentIdeaId);
if (!idea) return;
if (Saved.isSaved(currentIdeaId)) {
showToast('Already saved!', '♥');
} else {
Saved.save(idea);
showToast('Saved to your board', '♥');
}
}
function saveCurrentAndGo() {
saveCurrent();
setTimeout(() => location.href = 'saved.html', 600);
}
function printCard() {
window.print();
}
init();
</script>
</body>
</html>