-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbook.html
More file actions
386 lines (359 loc) · 10.5 KB
/
book.html
File metadata and controls
386 lines (359 loc) · 10.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Techie Taboo - Companion Book Mockup</title>
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: Arial, sans-serif;
background: #2c2c2c;
padding: 20px;
}
.controls {
max-width: 1200px;
margin: 0 auto 20px;
background: white;
padding: 20px;
border-radius: 8px;
}
.controls h1 {
margin-bottom: 10px;
font-size: 24px;
}
.controls p {
margin-bottom: 15px;
color: #666;
}
.stats {
display: flex;
gap: 30px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.stat {
background: #f0f0f0;
padding: 10px 15px;
border-radius: 6px;
}
.stat strong {
display: block;
font-size: 24px;
color: #0A1F33;
}
.stat span {
font-size: 12px;
color: #666;
}
button {
background-color: #0A1F33;
color: white;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 8px;
cursor: pointer;
margin-right: 10px;
}
button:hover {
background-color: #0d2a47;
}
select {
padding: 10px;
font-size: 16px;
border-radius: 8px;
border: 1px solid #ddd;
margin-right: 10px;
}
.book-container {
max-width: 1200px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(63mm, 1fr));
gap: 10mm;
padding: 10mm;
background: white;
border-radius: 8px;
}
.page {
width: 63mm;
height: 88mm;
background: white;
border: 1px solid #ddd;
padding: 5mm;
display: flex;
flex-direction: column;
page-break-inside: avoid;
position: relative;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.page.cover {
background: linear-gradient(135deg, #0A1F33 0%, #1a3a5a 100%);
color: white;
justify-content: center;
align-items: center;
text-align: center;
}
.page.cover h1 {
font-size: 18px;
margin-bottom: 8px;
}
.page.cover p {
font-size: 10px;
opacity: 0.9;
}
.page.toc {
font-size: 8px;
}
.page.toc h2 {
font-size: 12px;
margin-bottom: 4mm;
border-bottom: 1px solid #ddd;
padding-bottom: 2mm;
}
.toc-item {
display: flex;
justify-content: space-between;
margin-bottom: 1mm;
line-height: 1.3;
}
.toc-category {
font-weight: bold;
margin-top: 2mm;
color: #0A1F33;
}
.page-number {
position: absolute;
bottom: 3mm;
right: 5mm;
font-size: 8px;
color: #999;
}
.term-page {
font-size: 9px;
}
.term-page h3 {
font-size: 13px;
margin-bottom: 3mm;
color: #0A1F33;
border-bottom: 2px solid #0A1F33;
padding-bottom: 2mm;
}
.category-badge {
display: inline-block;
background: #f0f0f0;
padding: 1mm 2mm;
border-radius: 2mm;
font-size: 7px;
margin-bottom: 2mm;
color: #666;
}
.taboo-words {
margin-bottom: 3mm;
}
.taboo-words strong {
display: block;
margin-bottom: 1mm;
font-size: 8px;
color: #666;
}
.taboo-list {
display: flex;
flex-wrap: wrap;
gap: 1mm;
}
.taboo-word {
background: #ffe6e6;
padding: 1mm 2mm;
border-radius: 2mm;
font-size: 8px;
color: #cc0000;
}
.definition {
line-height: 1.4;
color: #333;
}
@media print {
body { background: white; padding: 0; }
.controls { display: none; }
.book-container {
display: block;
padding: 0;
background: white;
}
.page {
page-break-after: always;
box-shadow: none;
margin: 0;
}
.page:last-child {
page-break-after: auto;
}
}
</style>
</head>
<body>
<div class="controls">
<h1>📖 Techie Taboo Companion Book Mockup</h1>
<p>Card size: 63mm × 88mm (Poker size) | Pages can be printed double-sided</p>
<div class="stats">
<div class="stat">
<strong id="totalPages">0</strong>
<span>Total Pages</span>
</div>
<div class="stat">
<strong id="totalTerms">0</strong>
<span>Total Terms</span>
</div>
<div class="stat">
<strong id="sheetsNeeded">0</strong>
<span>Sheets (Double-Sided)</span>
</div>
<div class="stat">
<strong id="estimatedCost">¥0</strong>
<span>Est. Printing Cost</span>
</div>
</div>
<div style="margin-bottom: 10px;">
<label>Filter by category: </label>
<select id="categoryFilter">
<option value="variety">Variety Pack Only (216 terms)</option>
<option value="all">All Categories</option>
<option value="General">General</option>
<option value="AI">AI</option>
<option value="Software Engineering">Software Engineering</option>
<option value="Data">Data</option>
<option value="Product Management">Product Management</option>
<option value="Data Structures & Algorithms">DSA</option>
<option value="System Design">System Design</option>
</select>
<label style="margin-left: 20px;">
<input type="checkbox" id="includeDefinitions" checked>
Include placeholder definitions
</label>
</div>
<button onclick="window.print()">🖨️ Print Book</button>
<button onclick="generatePDF()">📄 Download PDF</button>
</div>
<div class="book-container" id="bookContainer"></div>
<script src="./public/scripts/data/tabooList.js"></script>
<script>
// Combine all lists
const allTerms = [
...generalTabooList,
...aiTabooList,
...softwareEngineeringTabooList,
...dataTabooList,
...productManagementTabooList,
...dsaTabooList,
...systemDesignTabooList
];
// Variety pack definition (from comment in tabooList.js)
const varietyPackTerms = [
...generalTabooList.slice(0, 60),
...aiTabooList.slice(0, 16),
...softwareEngineeringTabooList.slice(0, 16),
...productManagementTabooList.slice(0, 16)
];
function generateBook(terms, includeDefinitions) {
const container = document.getElementById('bookContainer');
container.innerHTML = '';
let pageNumber = 1;
// Cover page
const cover = document.createElement('div');
cover.className = 'page cover';
cover.innerHTML = `
<h1>TECHIE TABOO</h1>
<p>Companion Book</p>
<p style="margin-top: 20px; font-size: 8px;">Technical Terms & Definitions</p>
`;
container.appendChild(cover);
pageNumber++;
// Table of Contents
const categories = {};
terms.forEach(term => {
if (!categories[term.category]) {
categories[term.category] = [];
}
categories[term.category].push(term);
});
const toc = document.createElement('div');
toc.className = 'page toc';
let tocHTML = '<h2>Table of Contents</h2>';
let currentPage = pageNumber + 1;
Object.keys(categories).forEach(category => {
tocHTML += `<div class="toc-category">${category} (${categories[category].length} terms)</div>`;
categories[category].forEach(term => {
tocHTML += `<div class="toc-item"><span>${term.word}</span><span>p.${currentPage}</span></div>`;
currentPage++;
});
});
toc.innerHTML = tocHTML;
container.appendChild(toc);
pageNumber++;
// Term pages
terms.forEach(term => {
const page = document.createElement('div');
page.className = 'page term-page';
let content = `
<div class="category-badge">${term.category}</div>
<h3>${term.word}</h3>
<div class="taboo-words">
<strong>⛔ Taboo Words:</strong>
<div class="taboo-list">
${term.taboo.map(t => `<span class="taboo-word">${t}</span>`).join('')}
</div>
</div>
`;
if (includeDefinitions) {
content += `
<div class="definition">
<strong style="font-size: 8px; color: #666; margin-bottom: 1mm; display: block;">Definition:</strong>
<p style="font-style: italic; color: #999;">
[Placeholder: Add concise definition explaining what "${term.word}" means in simple terms,
avoiding the taboo words listed above.]
</p>
</div>
`;
}
content += `<div class="page-number">${pageNumber}</div>`;
page.innerHTML = content;
container.appendChild(page);
pageNumber++;
});
// Update stats
const totalPages = pageNumber - 1;
const sheetsNeeded = Math.ceil(totalPages / 2);
const costPerSheet = 0.5; // Estimated ¥0.5 per sheet
const estimatedCost = (sheetsNeeded * costPerSheet).toFixed(1);
document.getElementById('totalPages').textContent = totalPages;
document.getElementById('totalTerms').textContent = terms.length;
document.getElementById('sheetsNeeded').textContent = sheetsNeeded;
document.getElementById('estimatedCost').textContent = `¥${estimatedCost}`;
}
function updateBook() {
const filter = document.getElementById('categoryFilter').value;
const includeDefinitions = document.getElementById('includeDefinitions').checked;
let terms;
if (filter === 'all') {
terms = allTerms;
} else if (filter === 'variety') {
terms = varietyPackTerms;
} else {
terms = allTerms.filter(t => t.category === filter);
}
generateBook(terms, includeDefinitions);
}
function generatePDF() {
alert('To generate PDF:\n1. Click "Print Book" button\n2. Select "Save as PDF" as the printer\n3. Ensure page size is set to 63mm × 88mm or use default and trim');
}
// Event listeners
document.getElementById('categoryFilter').addEventListener('change', updateBook);
document.getElementById('includeDefinitions').addEventListener('change', updateBook);
// Initial render
updateBook();
</script>
</body>
</html>