-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquotes.html
More file actions
394 lines (371 loc) · 19.7 KB
/
Copy pathquotes.html
File metadata and controls
394 lines (371 loc) · 19.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inspirational Quotes - Hindi Tutor Point</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<style>
:root { --primary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
body {
background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
min-height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.navbar {
background: white !important;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.navbar-brand {
font-weight: 700;
background: var(--primary-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-size: 1.5rem;
}
.nav-link {
color: #f5576c !important;
font-weight: 500;
transition: all 0.3s ease;
position: relative;
}
.nav-link:hover { color: #f093fb !important; }
.nav-link::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 2px;
background: var(--primary-gradient);
transition: all 0.3s ease;
transform: translateX(-50%);
}
.nav-link:hover::after { width: 80%; }
.hero-section {
background: var(--primary-gradient);
color: white;
padding: 4rem 0 3rem;
margin-bottom: 2rem;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.quote-card {
background: white;
border-radius: 20px;
padding: 2.5rem;
margin-bottom: 2rem;
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
transition: all 0.4s ease;
position: relative;
overflow: hidden;
}
.quote-card::before {
content: '"';
position: absolute;
top: -20px;
left: 20px;
font-size: 150px;
color: rgba(240, 147, 251, 0.1);
font-family: Georgia, serif;
line-height: 1;
}
.quote-card:hover {
transform: translateY(-8px);
box-shadow: 0 15px 45px rgba(0,0,0,0.2);
}
.quote-text {
font-size: 1.4rem;
line-height: 1.8;
font-style: italic;
color: #333;
margin-bottom: 1.5rem;
position: relative;
z-index: 1;
}
.quote-author {
font-size: 1.1rem;
font-weight: 600;
color: #f5576c;
display: flex;
align-items: center;
gap: 0.5rem;
}
.search-box {
border-radius: 25px;
border: 2px solid #f5576c;
padding: 0.7rem 1.5rem;
}
.search-box:focus {
box-shadow: 0 0 0 0.2rem rgba(245, 87, 108, 0.25);
border-color: #f093fb;
}
.card {
border: none;
border-radius: 15px;
box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}
.key-value-display {
background: #f8f9fa;
padding: 0.5rem 1rem;
border-radius: 8px;
margin: 0.3rem 0;
font-size: 0.95rem;
}
.key-name {
font-weight: 600;
color: #f5576c;
}
body.print-mode .navbar,
body.print-mode .hero-section,
body.print-mode footer,
body.print-mode .no-print,
body.print-mode .pagination { display: none !important; }
body.print-mode .print-only { display: block !important; }
body.print-mode .card { box-shadow: none; border: 1px solid #ddd; }
.print-only { display: none; }
.empty-state { text-align: center; padding: 3rem; color: #6c757d; }
.empty-state i { font-size: 3rem; margin-bottom: 1rem; display: block; }
</style>
</head>
<body>
<div x-data="quotesViewer()" x-init="init()">
<nav class="navbar navbar-expand-lg navbar-light bg-light sticky-top">
<div class="container">
<a class="navbar-brand d-flex align-items-center" href="index.html"><img src="jar.svg" alt="JAR" height="35" class="me-2"><span class="d-flex flex-column"><span>JAR</span><small class="text-muted" style="font-size:0.6rem;font-weight:400;line-height:1;background:none;-webkit-text-fill-color:#6c757d;color:#6c757d;">JSON API Repository</small></span></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="demographicDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-globe2 me-1"></i>Demographic
</a>
<ul class="dropdown-menu" aria-labelledby="demographicDropdown">
<li><a class="dropdown-item" href="regions.html"><i class="bi bi-globe me-1"></i>Regions</a></li>
<li><a class="dropdown-item" href="subregions.html"><i class="bi bi-map me-1"></i>Subregions</a></li>
<li><a class="dropdown-item" href="country.html"><i class="bi bi-flag me-1"></i>Countries</a></li>
<li><a class="dropdown-item" href="states.html"><i class="bi bi-building me-1"></i>States</a></li>
<li><a class="dropdown-item" href="cities.html"><i class="bi bi-geo-alt me-1"></i>Cities</a></li>
</ul>
</li>
<li class="nav-item"><a class="nav-link" href="personalities.html"><i class="bi bi-person-badge me-1"></i>Personalities</a></li>
<li class="nav-item"><a class="nav-link" href="quotes.html"><i class="bi bi-quote me-1"></i>Quotes</a></li>
<li class="nav-item"><a class="nav-link" href="blogs.html"><i class="bi bi-file-post me-1"></i>Blogs</a></li>
<li class="nav-item"><a class="nav-link" href="vocabulary.html"><i class="bi bi-book me-1"></i>Vocabulary</a></li>
<li class="nav-item"><a class="nav-link" href="https://github.com/hinditutorpoint/json" target="_blank"><i class="bi bi-github me-1"></i>GitHub</a></li>
</ul>
</div>
</div>
</nav>
<div class="hero-section">
<div class="container text-center">
<h1 class="display-4 fw-bold mb-3"><i class="bi bi-quote me-3"></i>Inspirational Quotes</h1>
<p class="lead mb-0">Words of wisdom to inspire and motivate</p>
</div>
</div>
<div class="container pb-5">
<div class="card mb-4">
<div class="card-body p-4">
<form @submit.prevent="searchQuery = searchQuery">
<div class="row g-2 align-items-center">
<div class="col-md-6">
<input type="text" class="form-control search-box" placeholder="Search quotes by text, author, category..." x-model="searchQuery" @input="currentPage = 1">
</div>
<div class="col-md-3 d-flex align-items-center">
<span class="text-muted small">
Showing <strong x-text="showingFrom"></strong>–<strong x-text="showingTo"></strong> of <strong x-text="filteredData.length"></strong>
</span>
</div>
<div class="col-md-3 d-flex align-items-center justify-content-end gap-2">
<div class="d-flex align-items-center gap-2 no-print">
<button class="btn btn-outline-secondary btn-sm" @click="printTable" title="Print / PDF"><i class="bi bi-printer"></i> Print</button>
<button class="btn btn-outline-success btn-sm" @click="exportExcel" title="Export to Excel"><i class="bi bi-file-earmark-excel"></i> Excel</button>
</div>
<div class="d-flex align-items-center gap-2 no-print">
<label class="form-label mb-0 text-nowrap small">Rows/page:</label>
<select class="form-select form-select-sm" style="width: auto;" x-model="itemsPerPage" @change="currentPage = 1">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="200">200</option>
</select>
</div>
</div>
</div>
</form>
</div>
</div>
<div x-show="loading" class="text-center py-5">
<div class="spinner-border text-danger" role="status"><span class="visually-hidden">Loading...</span></div>
<p class="text-muted mt-2">Loading quotes...</p>
</div>
<div x-show="error" class="alert alert-danger" x-text="error"></div>
<div x-show="!loading && !error">
<template x-if="filteredData.length === 0">
<div class="empty-state">
<i class="bi bi-search"></i>
<p class="fs-5">No quotes found matching your search.</p>
</div>
</template>
<template x-for="quote in paginatedData" :key="quote.id">
<div class="quote-card">
<div class="quote-text" x-text="quote.text || quote.quote || quote.content"></div>
<div class="quote-author">
<i class="bi bi-dash-lg"></i>
<span x-text="quote.author || 'Unknown'"></span>
</div>
<div class="mt-4">
<button @click="toggleDetails(quote.id)" class="btn btn-sm btn-outline-danger">
<span x-show="!showDetails.includes(quote.id)"><i class="bi bi-plus-circle me-1"></i>Show All Details</span>
<span x-show="showDetails.includes(quote.id)"><i class="bi bi-dash-circle me-1"></i>Hide Details</span>
</button>
<div x-show="showDetails.includes(quote.id)" x-collapse class="mt-3">
<h6 class="text-muted mb-3">All Data Fields:</h6>
<template x-for="[key, value] in Object.entries(quote)" :key="key">
<div class="key-value-display">
<span class="key-name" x-text="key"></span>:
<span x-text="formatValue(value)"></span>
</div>
</template>
</div>
</div>
</div>
</template>
<div class="print-only mt-4" id="print-section">
<table class="table table-bordered">
<thead><tr><th>#</th><th>Quote</th><th>Author</th></tr></thead>
<tbody>
<template x-for="quote in filteredData" :key="quote.id">
<tr><td x-text="quote.id"></td><td x-text="quote.text || quote.quote || quote.content"></td><td x-text="quote.author || 'Unknown'"></td></tr>
</template>
</tbody>
</table>
</div>
<nav class="mt-3 d-flex justify-content-center no-print" x-show="totalPages > 1">
<ul class="pagination pagination-sm mb-0">
<li class="page-item" :class="{ disabled: currentPage === 1 }">
<button class="page-link" @click="changePage(1)" :disabled="currentPage === 1">«</button>
</li>
<li class="page-item" :class="{ disabled: currentPage === 1 }">
<button class="page-link" @click="changePage(currentPage - 1)" :disabled="currentPage === 1">‹</button>
</li>
<template x-for="p in getPageNumbers()" :key="p">
<li class="page-item" :class="{ active: p === currentPage, disabled: p === '...' }">
<button class="page-link" x-text="p" @click="changePage(p)" :disabled="p === '...'"></button>
</li>
</template>
<li class="page-item" :class="{ disabled: currentPage === totalPages }">
<button class="page-link" @click="changePage(currentPage + 1)" :disabled="currentPage === totalPages">›</button>
</li>
<li class="page-item" :class="{ disabled: currentPage === totalPages }">
<button class="page-link" @click="changePage(totalPages)" :disabled="currentPage === totalPages">»</button>
</li>
</ul>
</nav>
</div>
</div>
<footer class="bg-dark text-white py-4 mt-5">
<div class="container text-center">
<p class="mb-2">
<i class="bi bi-github me-2"></i>
<a href="https://github.com/hinditutorpoint/json" target="_blank" class="text-white text-decoration-none">github.com/hinditutorpoint/json</a>
</p>
<p class="mb-0 text-muted">Built with Alpine.js & Bootstrap 5 | © 2026 Hindi Tutor Point</p>
</div>
</footer>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
function quotesViewer() {
return {
data: [],
loading: false,
error: null,
searchQuery: '',
currentPage: 1,
itemsPerPage: 10,
showDetails: [],
async init() { await this.loadData(); },
async loadData() {
this.loading = true;
this.error = null;
try {
const res = await fetch('https://raw.githubusercontent.com/hinditutorpoint/json/main/quotes.json');
if (!res.ok) throw new Error('Failed to load data: ' + res.status);
let json = await res.json();
this.data = Array.isArray(json) ? json.map((item, i) => ({ ...item, id: item.id || i + 1 })) : [json];
} catch (err) {
this.error = 'Failed to load quotes. Please try again later.';
console.error(err);
} finally { this.loading = false; }
},
get filteredData() {
if (!this.searchQuery) return this.data;
const q = this.searchQuery.toLowerCase();
return this.data.filter(item => JSON.stringify(item).toLowerCase().includes(q));
},
get totalPages() { return Math.ceil(this.filteredData.length / this.itemsPerPage) || 1; },
get paginatedData() {
const start = (this.currentPage - 1) * this.itemsPerPage;
return this.filteredData.slice(start, start + this.itemsPerPage);
},
get showingFrom() { return this.filteredData.length ? (this.currentPage - 1) * this.itemsPerPage + 1 : 0; },
get showingTo() { return Math.min(this.currentPage * this.itemsPerPage, this.filteredData.length); },
changePage(p) {
if (p >= 1 && p <= this.totalPages) { this.currentPage = p; window.scrollTo({ top: 0, behavior: 'smooth' }); }
},
getPageNumbers() {
const total = this.totalPages, cur = this.currentPage, pages = [];
if (total <= 7) { for (let i = 1; i <= total; i++) pages.push(i); }
else {
pages.push(1);
if (cur > 3) pages.push('...');
for (let i = Math.max(2, cur - 1); i <= Math.min(total - 1, cur + 1); i++) pages.push(i);
if (cur < total - 2) pages.push('...');
pages.push(total);
}
return pages;
},
printTable() {
const opt = {
margin: [5, 5, 5, 5],
filename: 'quotes.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2, useCORS: true },
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
};
document.body.classList.add('print-mode');
setTimeout(() => {
html2pdf().set(opt).from(document.getElementById('print-section')).save().then(() => {
document.body.classList.remove('print-mode');
}).catch(() => { document.body.classList.remove('print-mode'); });
}, 300);
},
exportExcel() {
const rows = [['ID', 'Quote', 'Author']];
this.filteredData.forEach(q => rows.push([q.id, (q.text || q.quote || q.content || ''), q.author || '']));
const csv = rows.map(r => r.map(v => '"' + String(v).replace(/"/g, '""') + '"').join(',')).join('\n');
const blob = new Blob(['\uFEFF' + csv], { type: 'text/csv;charset=utf-8;' });
const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = 'quotes.csv'; a.click();
URL.revokeObjectURL(a.href);
},
toggleDetails(id) {
const idx = this.showDetails.indexOf(id);
idx > -1 ? this.showDetails.splice(idx, 1) : this.showDetails.push(id);
},
formatValue(value) {
if (Array.isArray(value)) return value.join(', ');
if (typeof value === 'object' && value !== null) return JSON.stringify(value);
return value;
}
}
}
</script>
</body>
</html>