Spaces:
Running
Running
Update index.html
Browse files- index.html +220 -251
index.html
CHANGED
|
@@ -3,296 +3,265 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
-
<link
|
| 9 |
<style>
|
| 10 |
:root {
|
| 11 |
-
--
|
| 12 |
-
--
|
| 13 |
-
--accent: #
|
| 14 |
-
--text-main: #f8fafc;
|
| 15 |
-
--text-muted: #94a3b8;
|
| 16 |
-
--border: #334155;
|
| 17 |
-
--link-color: #38bdf8;
|
| 18 |
-
--url-color: #4ade80;
|
| 19 |
}
|
|
|
|
| 20 |
body {
|
| 21 |
-
background
|
| 22 |
-
color:
|
| 23 |
-
font-family: 'Inter',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
-
|
| 26 |
-
.
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
|
| 30 |
-
|
| 31 |
-
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
| 32 |
-
.tab-btn.active { border-bottom: 2px solid var(--accent); color: var(--accent); }
|
| 33 |
-
|
| 34 |
-
.animate-fadeIn { animation: fadeIn 0.4s ease-out forwards; }
|
| 35 |
-
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
| 36 |
-
|
| 37 |
-
.ai-summary-box {
|
| 38 |
-
background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
|
| 39 |
-
border: 1px solid #fbbf2433;
|
| 40 |
}
|
| 41 |
|
| 42 |
-
.
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
position: relative;
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
}
|
| 56 |
-
|
| 57 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
</style>
|
| 59 |
</head>
|
| 60 |
-
<body class="
|
| 61 |
-
|
| 62 |
-
<!-- Header -->
|
| 63 |
-
<header class="
|
| 64 |
-
<div class="flex
|
| 65 |
-
<div class="flex items-center gap-
|
| 66 |
-
<div class="
|
| 67 |
-
|
|
|
|
|
|
|
| 68 |
</div>
|
| 69 |
|
| 70 |
-
<div class="flex-1 max-w-
|
| 71 |
<input
|
| 72 |
type="text"
|
| 73 |
-
id="
|
| 74 |
-
placeholder="Tìm
|
| 75 |
-
class="
|
|
|
|
| 76 |
>
|
| 77 |
-
<button
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
</button>
|
| 80 |
</div>
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
| 84 |
</div>
|
| 85 |
</header>
|
| 86 |
|
| 87 |
-
<
|
| 88 |
-
|
| 89 |
-
<div class="flex
|
| 90 |
-
<
|
| 91 |
-
<
|
| 92 |
-
<button class="tab-btn text-[var(--text-muted)] hover:text-white h-full px-2" data-type="videos">Video</button>
|
| 93 |
-
<button class="tab-btn text-[var(--text-muted)] hover:text-white h-full px-2" data-type="news">Tin tức</button>
|
| 94 |
</div>
|
| 95 |
-
</div>
|
| 96 |
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
<div class="
|
| 103 |
-
<p id="loadingText" class="mt-4 text-sm text-[var(--text-muted)] italic">Đang bóc tách dữ liệu tìm kiếm...</p>
|
| 104 |
</div>
|
| 105 |
|
| 106 |
-
<div
|
| 107 |
-
<
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
<
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
</div>
|
| 114 |
-
</
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
<script>
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
const
|
| 122 |
-
const
|
| 123 |
-
|
| 124 |
-
const tabButtons = document.querySelectorAll('.tab-btn');
|
| 125 |
-
|
| 126 |
-
let currentType = 'all';
|
| 127 |
-
|
| 128 |
-
tabButtons.forEach(btn => {
|
| 129 |
-
btn.addEventListener('click', () => {
|
| 130 |
-
tabButtons.forEach(b => b.classList.remove('active', 'text-[var(--accent)]'));
|
| 131 |
-
btn.classList.add('active', 'text-[var(--accent)]');
|
| 132 |
-
currentType = btn.getAttribute('data-type');
|
| 133 |
-
performSearch();
|
| 134 |
-
});
|
| 135 |
-
});
|
| 136 |
-
|
| 137 |
-
searchInput.addEventListener('keypress', (e) => {
|
| 138 |
-
if (e.key === 'Enter') performSearch();
|
| 139 |
-
});
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
if (uddg) return decodeURIComponent(uddg);
|
| 150 |
-
}
|
| 151 |
-
if (url.startsWith('//')) return 'https:' + url;
|
| 152 |
-
if (url.startsWith('/')) return 'https://duckduckgo.com' + url;
|
| 153 |
-
return url;
|
| 154 |
-
} catch (e) {
|
| 155 |
-
return url;
|
| 156 |
-
}
|
| 157 |
}
|
|
|
|
| 158 |
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
resultsArea.innerHTML = '';
|
| 165 |
-
loading.classList.remove('hidden');
|
| 166 |
-
|
| 167 |
-
let searchQuery = query;
|
| 168 |
-
if (currentType === 'images') searchQuery += " site:pinterest.com OR site:unsplash.com OR site:pixabay.com";
|
| 169 |
-
if (currentType === 'videos') searchQuery += " site:youtube.com OR site:vimeo.com";
|
| 170 |
-
|
| 171 |
-
const targetUrl = "https://duckduckgo.com/html/?q=" + encodeURIComponent(searchQuery);
|
| 172 |
-
|
| 173 |
-
try {
|
| 174 |
-
const response = await fetch("https://api.allorigins.win/get?url=" + encodeURIComponent(targetUrl));
|
| 175 |
-
const data = await response.json();
|
| 176 |
-
const parser = new DOMParser();
|
| 177 |
-
const doc = parser.parseFromString(data.contents, 'text/html');
|
| 178 |
-
const results = Array.from(doc.querySelectorAll('.result'));
|
| 179 |
-
|
| 180 |
-
if (results.length === 0) {
|
| 181 |
-
resultsArea.innerHTML = '<p class="text-center py-10 text-zinc-500">Không tìm thấy dữ liệu phù hợp.</p>';
|
| 182 |
-
} else {
|
| 183 |
-
if (currentType === 'images') renderImages(results);
|
| 184 |
-
else if (currentType === 'videos') renderVideos(results);
|
| 185 |
-
else renderAll(results, query);
|
| 186 |
-
}
|
| 187 |
-
} catch (error) {
|
| 188 |
-
resultsArea.innerHTML = '<p class="text-red-400 text-center py-10">Lỗi kết nối Proxy. Vui lòng kiểm tra lại đường truyền.</p>';
|
| 189 |
-
} finally {
|
| 190 |
-
loading.classList.add('hidden');
|
| 191 |
-
}
|
| 192 |
-
}
|
| 193 |
|
| 194 |
-
|
| 195 |
-
let html = '<div class="image-grid animate-fadeIn">';
|
| 196 |
-
results.forEach((res) => {
|
| 197 |
-
const aTag = res.querySelector('.result__a');
|
| 198 |
-
if (!aTag) return;
|
| 199 |
-
const link = cleanDDGUrl(aTag.getAttribute('href'));
|
| 200 |
-
let domain = "web";
|
| 201 |
-
try { domain = new URL(link).hostname; } catch(e) {}
|
| 202 |
-
|
| 203 |
-
const screenshotUrl = "https://api.microlink.io/?url=" + encodeURIComponent(link) + "&screenshot=true&embed=screenshot.url";
|
| 204 |
-
|
| 205 |
-
html += `
|
| 206 |
-
<a href="${link}" target="_blank" class="image-item group">
|
| 207 |
-
<img src="${screenshotUrl}"
|
| 208 |
-
onerror="this.src='https://via.placeholder.com/300?text=${domain}'"
|
| 209 |
-
loading="lazy">
|
| 210 |
-
<div class="absolute bottom-0 left-0 right-0 p-2 bg-black/60 text-[10px] truncate opacity-0 group-hover:opacity-100 transition-opacity">
|
| 211 |
-
${domain}
|
| 212 |
-
</div>
|
| 213 |
-
</a>
|
| 214 |
-
`;
|
| 215 |
-
});
|
| 216 |
-
html += '</div>';
|
| 217 |
-
resultsArea.innerHTML = html;
|
| 218 |
-
}
|
| 219 |
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
const screenshotUrl = "https://api.microlink.io/?url=" + encodeURIComponent(link) + "&screenshot=true&embed=screenshot.url";
|
| 233 |
-
|
| 234 |
-
html += `
|
| 235 |
-
<div class="flex flex-col md:flex-row gap-4 p-4 rounded-2xl bg-[var(--surface-dark)] border border-[var(--border)] hover:border-[var(--accent)] transition-all">
|
| 236 |
-
<div class="w-full md:w-48 aspect-video rounded-lg overflow-hidden bg-black flex-shrink-0">
|
| 237 |
-
<img src="${screenshotUrl}"
|
| 238 |
-
class="w-full h-full object-cover"
|
| 239 |
-
onerror="this.parentElement.innerHTML='<div class=\'w-full h-full flex items-center justify-center\'><i class=\'fas fa-play text-2xl text-zinc-700\'></i></div>'">
|
| 240 |
-
</div>
|
| 241 |
-
<div class="flex-1">
|
| 242 |
-
<div class="text-[10px] text-[var(--url-color)] mb-1 uppercase font-bold tracking-widest">${domain}</div>
|
| 243 |
-
<a href="${link}" target="_blank" class="block mb-2 text-lg font-bold text-[var(--link-color)] hover:underline line-clamp-1">${title}</a>
|
| 244 |
-
<p class="text-sm text-[var(--text-muted)] line-clamp-2">${desc}</p>
|
| 245 |
-
</div>
|
| 246 |
-
</div>
|
| 247 |
-
`;
|
| 248 |
-
});
|
| 249 |
-
html += '</div>';
|
| 250 |
-
resultsArea.innerHTML = html;
|
| 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 |
-
try { domain = new URL(link).hostname; } catch(e) {}
|
| 279 |
-
|
| 280 |
-
html += `
|
| 281 |
-
<div class="result-card group animate-fadeIn" style="animation-delay: ${i*0.05}s">
|
| 282 |
-
<div class="flex items-center gap-2 mb-1">
|
| 283 |
-
<img src="https://www.google.com/s2/favicons?domain=${domain}&sz=32" class="w-3.5 h-3.5" alt="icon">
|
| 284 |
-
<span class="text-[11px] text-[var(--url-color)] font-medium">${domain}</span>
|
| 285 |
-
</div>
|
| 286 |
-
<a href="${link}" target="_blank" class="block group">
|
| 287 |
-
<h3 class="result-title text-[18px] text-[var(--link-color)] mb-1 leading-tight font-semibold">${title}</h3>
|
| 288 |
-
</a>
|
| 289 |
-
<p class="text-[13px] text-[var(--text-muted)] leading-relaxed line-clamp-2">${desc}</p>
|
| 290 |
-
</div>
|
| 291 |
-
`;
|
| 292 |
-
});
|
| 293 |
-
resultsArea.innerHTML = html;
|
| 294 |
}
|
| 295 |
-
}
|
| 296 |
</script>
|
| 297 |
</body>
|
| 298 |
-
</html>
|
|
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Wiki Glass Dark Reader</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Lora:ital,wght@0,400;0,700;1,400&display=swap" rel="stylesheet">
|
| 9 |
<style>
|
| 10 |
:root {
|
| 11 |
+
--glass-bg: rgba(25, 25, 25, 0.65);
|
| 12 |
+
--glass-border: rgba(255, 255, 255, 0.08);
|
| 13 |
+
--accent-blue: #3b82f6;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
}
|
| 15 |
+
|
| 16 |
body {
|
| 17 |
+
background: radial-gradient(circle at top right, #1e293b, #0f172a, #020617);
|
| 18 |
+
color: #e2e8f0;
|
| 19 |
+
font-family: 'Inter', sans-serif;
|
| 20 |
+
min-height: 100vh;
|
| 21 |
+
overflow-x: hidden;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.glass {
|
| 25 |
+
background: var(--glass-bg);
|
| 26 |
+
backdrop-filter: blur(20px);
|
| 27 |
+
-webkit-backdrop-filter: blur(20px);
|
| 28 |
+
border: 1px solid var(--glass-border);
|
| 29 |
}
|
| 30 |
+
|
| 31 |
+
.wiki-content-area {
|
| 32 |
+
line-height: 1.8;
|
| 33 |
+
font-size: 1.125rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
+
.wiki-content-area h2 {
|
| 37 |
+
font-size: 1.75rem;
|
| 38 |
+
font-weight: 700;
|
| 39 |
+
margin-top: 2.5rem;
|
| 40 |
+
margin-bottom: 1.25rem;
|
| 41 |
+
color: #f8fafc;
|
| 42 |
+
border-bottom: 1px solid var(--glass-border);
|
| 43 |
+
padding-bottom: 0.5rem;
|
| 44 |
}
|
| 45 |
+
|
| 46 |
+
.wiki-content-area p {
|
| 47 |
+
margin-bottom: 1.5rem;
|
| 48 |
+
color: #cbd5e1;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.wiki-content-area b, .wiki-content-area strong {
|
| 52 |
+
color: #f1f5f9;
|
| 53 |
+
font-weight: 600;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.wiki-content-area ul {
|
| 57 |
+
list-style-type: none;
|
| 58 |
+
padding-left: 1rem;
|
| 59 |
+
margin-bottom: 1.5rem;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.wiki-content-area li {
|
| 63 |
position: relative;
|
| 64 |
+
padding-left: 1.5rem;
|
| 65 |
+
margin-bottom: 0.75rem;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.wiki-content-area li::before {
|
| 69 |
+
content: "•";
|
| 70 |
+
color: var(--accent-blue);
|
| 71 |
+
position: absolute;
|
| 72 |
+
left: 0;
|
| 73 |
+
font-weight: bold;
|
| 74 |
}
|
| 75 |
+
|
| 76 |
+
.search-input {
|
| 77 |
+
background: rgba(255, 255, 255, 0.05);
|
| 78 |
+
border: 1px solid var(--glass-border);
|
| 79 |
+
transition: all 0.3s ease;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.search-input:focus {
|
| 83 |
+
background: rgba(255, 255, 255, 0.1);
|
| 84 |
+
border-color: var(--accent-blue);
|
| 85 |
+
box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.font-serif { font-family: 'Lora', serif; }
|
| 89 |
+
.font-sans { font-family: 'Inter', sans-serif; }
|
| 90 |
+
|
| 91 |
+
.image-shimmer {
|
| 92 |
+
background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
|
| 93 |
+
background-size: 200% 100%;
|
| 94 |
+
animation: shimmer 2s infinite;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
@keyframes shimmer {
|
| 98 |
+
0% { background-position: 200% 0; }
|
| 99 |
+
100% { background-position: -200% 0; }
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.custom-scroll::-webkit-scrollbar { width: 8px; }
|
| 103 |
+
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
|
| 104 |
+
.custom-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
|
| 105 |
+
.custom-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
|
| 106 |
</style>
|
| 107 |
</head>
|
| 108 |
+
<body class="custom-scroll">
|
| 109 |
+
|
| 110 |
+
<!-- Sticky Header -->
|
| 111 |
+
<header class="glass sticky top-0 z-50 px-6 py-4">
|
| 112 |
+
<div class="max-w-5xl mx-auto flex flex-col sm:flex-row items-center gap-6">
|
| 113 |
+
<div class="flex items-center gap-3">
|
| 114 |
+
<div class="w-10 h-10 bg-blue-600 rounded-xl flex items-center justify-center shadow-lg shadow-blue-900/20">
|
| 115 |
+
<svg class="text-white w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332-4.5-1.253"></path></svg>
|
| 116 |
+
</div>
|
| 117 |
+
<h1 class="text-xl font-extrabold tracking-tighter text-white">WIKI<span class="text-blue-500">GLASS</span></h1>
|
| 118 |
</div>
|
| 119 |
|
| 120 |
+
<div class="relative flex-1 w-full max-w-2xl">
|
| 121 |
<input
|
| 122 |
type="text"
|
| 123 |
+
id="searchQuery"
|
| 124 |
+
placeholder="Tìm kiếm kiến thức..."
|
| 125 |
+
class="search-input w-full py-3 px-5 rounded-2xl outline-none text-white placeholder-gray-500"
|
| 126 |
+
onkeypress="if(event.key === 'Enter') performWikiFetch()"
|
| 127 |
>
|
| 128 |
+
<button
|
| 129 |
+
onclick="performWikiFetch()"
|
| 130 |
+
class="absolute right-2 top-1.5 bottom-1.5 px-5 bg-blue-600 hover:bg-blue-500 text-white text-sm font-bold rounded-xl transition-all active:scale-95"
|
| 131 |
+
>
|
| 132 |
+
TRA CỨU
|
| 133 |
</button>
|
| 134 |
</div>
|
| 135 |
+
|
| 136 |
+
<div class="flex gap-2">
|
| 137 |
+
<button onclick="toggleFont()" id="fontBtn" class="p-2 rounded-lg bg-white/5 hover:bg-white/10 text-xs font-medium border border-white/10">SERIF</button>
|
| 138 |
+
</div>
|
| 139 |
</div>
|
| 140 |
</header>
|
| 141 |
|
| 142 |
+
<main class="max-w-4xl mx-auto px-6 py-12">
|
| 143 |
+
<!-- Loader -->
|
| 144 |
+
<div id="loader" class="hidden flex flex-col items-center justify-center py-20">
|
| 145 |
+
<div class="w-12 h-12 border-4 border-blue-500/30 border-t-blue-500 rounded-full animate-spin"></div>
|
| 146 |
+
<p class="mt-4 text-gray-400 font-medium">Đang xử lý dữ liệu Wiki...</p>
|
|
|
|
|
|
|
| 147 |
</div>
|
|
|
|
| 148 |
|
| 149 |
+
<!-- Article Container -->
|
| 150 |
+
<article id="articleFrame" class="hidden">
|
| 151 |
+
<!-- Hero Image Section -->
|
| 152 |
+
<div id="heroBox" class="relative w-full h-[300px] md:h-[450px] rounded-[2rem] overflow-hidden mb-12 glass shadow-2xl hidden">
|
| 153 |
+
<img id="articleImage" src="" class="w-full h-full object-cover">
|
| 154 |
+
<div class="absolute inset-0 bg-gradient-to-t from-slate-950/80 to-transparent"></div>
|
|
|
|
| 155 |
</div>
|
| 156 |
|
| 157 |
+
<div class="glass rounded-[2.5rem] p-8 md:p-16 relative overflow-hidden">
|
| 158 |
+
<div class="absolute top-0 left-0 w-32 h-32 bg-blue-600/10 blur-[80px] -z-10"></div>
|
| 159 |
+
|
| 160 |
+
<header class="mb-10">
|
| 161 |
+
<div class="flex items-center gap-3 mb-4">
|
| 162 |
+
<span class="px-3 py-1 bg-blue-500/10 text-blue-400 text-[10px] font-bold uppercase tracking-[0.2em] rounded-full border border-blue-500/20">Wikipedia Source</span>
|
| 163 |
+
<span id="langTag" class="text-gray-500 text-[10px] font-bold uppercase">VI_VN</span>
|
| 164 |
+
</div>
|
| 165 |
+
<h2 id="articleTitle" class="text-4xl md:text-6xl font-extrabold text-white leading-tight"></h2>
|
| 166 |
+
</header>
|
| 167 |
+
|
| 168 |
+
<div id="articleContent" class="wiki-content-area font-sans">
|
| 169 |
+
<!-- Wikipedia content injected here -->
|
| 170 |
</div>
|
| 171 |
+
|
| 172 |
+
<footer class="mt-16 pt-8 border-t border-white/5 flex flex-col sm:flex-row justify-between items-center gap-6">
|
| 173 |
+
<p class="text-gray-500 text-sm italic">Nội dung được cung cấp theo giấy phép Creative Commons.</p>
|
| 174 |
+
<a id="sourceUrl" href="#" target="_blank" class="flex items-center gap-2 text-blue-400 font-bold hover:text-blue-300 transition-colors">
|
| 175 |
+
Mở liên kết gốc
|
| 176 |
+
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"></path></svg>
|
| 177 |
+
</a>
|
| 178 |
+
</footer>
|
| 179 |
</div>
|
| 180 |
+
</article>
|
| 181 |
+
|
| 182 |
+
<!-- Initial Placeholder -->
|
| 183 |
+
<div id="emptyState" class="text-center py-20 opacity-40">
|
| 184 |
+
<div class="text-8xl mb-6">🔭</div>
|
| 185 |
+
<h3 class="text-2xl font-bold text-white mb-2">Trung tâm Tri thức Glass</h3>
|
| 186 |
+
<p class="max-w-xs mx-auto text-gray-400">Khám phá thế giới qua lăng kính trực quan và hiện đại.</p>
|
| 187 |
+
</div>
|
| 188 |
+
</main>
|
| 189 |
|
| 190 |
<script>
|
| 191 |
+
let isSerif = false;
|
| 192 |
+
|
| 193 |
+
function toggleFont() {
|
| 194 |
+
const content = document.getElementById('articleContent');
|
| 195 |
+
const btn = document.getElementById('fontBtn');
|
| 196 |
+
isSerif = !isSerif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
+
if (isSerif) {
|
| 199 |
+
content.classList.remove('font-sans');
|
| 200 |
+
content.classList.add('font-serif');
|
| 201 |
+
btn.innerText = 'SANS';
|
| 202 |
+
} else {
|
| 203 |
+
content.classList.remove('font-serif');
|
| 204 |
+
content.classList.add('font-sans');
|
| 205 |
+
btn.innerText = 'SERIF';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
}
|
| 207 |
+
}
|
| 208 |
|
| 209 |
+
async function performWikiFetch() {
|
| 210 |
+
const query = document.getElementById('searchQuery').value.trim();
|
| 211 |
+
const loader = document.getElementById('loader');
|
| 212 |
+
const frame = document.getElementById('articleFrame');
|
| 213 |
+
const empty = document.getElementById('emptyState');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
+
if (!query) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
+
// UI Transitions
|
| 218 |
+
loader.classList.remove('hidden');
|
| 219 |
+
frame.classList.add('hidden');
|
| 220 |
+
empty.classList.add('hidden');
|
| 221 |
+
|
| 222 |
+
try {
|
| 223 |
+
// Search for the most relevant page
|
| 224 |
+
const sUrl = `https://vi.wikipedia.org/w/api.php?action=query&list=search&srsearch=${encodeURIComponent(query)}&format=json&origin=*`;
|
| 225 |
+
const sResp = await fetch(sUrl);
|
| 226 |
+
const sData = await sResp.json();
|
| 227 |
+
|
| 228 |
+
if (!sData.query.search.length) throw "Không tìm thấy dữ liệu phù hợp.";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
+
const bestMatch = sData.query.search[0].title;
|
| 231 |
+
|
| 232 |
+
// Fetch content and high-res image
|
| 233 |
+
const cUrl = `https://vi.wikipedia.org/w/api.php?action=query&prop=extracts|pageimages&titles=${encodeURIComponent(bestMatch)}&format=json&origin=*&pithumbsize=1200`;
|
| 234 |
+
const cResp = await fetch(cUrl);
|
| 235 |
+
const cData = await cResp.json();
|
| 236 |
+
|
| 237 |
+
const pages = cData.query.pages;
|
| 238 |
+
const pid = Object.keys(pages)[0];
|
| 239 |
+
const page = pages[pid];
|
| 240 |
+
|
| 241 |
+
// Update UI
|
| 242 |
+
document.getElementById('articleTitle').innerText = page.title;
|
| 243 |
+
document.getElementById('articleContent').innerHTML = page.extract;
|
| 244 |
+
document.getElementById('sourceUrl').href = `https://vi.wikipedia.org/wiki/${encodeURIComponent(page.title)}`;
|
| 245 |
+
|
| 246 |
+
const hero = document.getElementById('heroBox');
|
| 247 |
+
if (page.thumbnail) {
|
| 248 |
+
document.getElementById('articleImage').src = page.thumbnail.source;
|
| 249 |
+
hero.classList.remove('hidden');
|
| 250 |
+
} else {
|
| 251 |
+
hero.classList.add('hidden');
|
| 252 |
}
|
| 253 |
|
| 254 |
+
loader.classList.add('hidden');
|
| 255 |
+
frame.classList.remove('hidden');
|
| 256 |
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
| 257 |
+
|
| 258 |
+
} catch (err) {
|
| 259 |
+
loader.classList.add('hidden');
|
| 260 |
+
empty.classList.remove('hidden');
|
| 261 |
+
alert(err);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
}
|
| 263 |
+
}
|
| 264 |
</script>
|
| 265 |
</body>
|
| 266 |
+
</html>
|
| 267 |
+
|