File size: 31,882 Bytes
1319a12 |
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 |
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Meting API - 强大的音乐服务接口</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');
body {
font-family: 'Noto Sans SC', sans-serif;
/* MODIFIED: Slightly softer gradient */
background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
min-height: 100vh;
color: #374151; /* Default text color */
}
.card {
transition: all 0.3s ease-in-out; /* MODIFIED: Smoother transition */
box-shadow: 0 8px 16px rgba(0,0,0,0.08); /* MODIFIED: Softer base shadow */
border-radius: 12px;
overflow: hidden;
background: rgba(255,255,255,0.95); /* MODIFIED: Slightly more opaque for readability */
backdrop-filter: blur(8px); /* MODIFIED: Slightly stronger blur */
}
.card:hover {
transform: translateY(-6px); /* MODIFIED: Slightly more lift */
box-shadow: 0 12px 24px rgba(0,0,0,0.12); /* MODIFIED: More pronounced hover shadow */
}
.gradient-text {
background: linear-gradient(90deg, #3b82f6, #8b5cf6);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.nav-link {
position: relative;
padding-bottom: 4px; /* ADDED: Space for underline */
}
.nav-link::after {
content: '';
position: absolute;
width: 0;
height: 2px;
bottom: 0;
left: 50%; /* MODIFIED: Start from center */
transform: translateX(-50%); /* MODIFIED: Center align */
background-color: #3b82f6;
transition: width 0.3s ease-in-out;
}
.nav-link:hover::after, .nav-link.active::after { /* ADDED: Active state for underline */
width: 100%;
}
.btn-primary {
background: linear-gradient(90deg, #3b82f6, #8b5cf6);
transition: all 0.3s ease-in-out;
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); /* ADDED: Base shadow for button */
}
.btn-primary:hover {
transform: translateY(-3px); /* MODIFIED: Consistent lift */
box-shadow: 0 7px 20px rgba(59, 130, 246, 0.45); /* MODIFIED: Enhanced hover shadow */
}
.fade-in {
/* JS will handle opacity and transform, this class is a marker */
}
/* Removed @keyframes fadeIn as JS handles this with IntersectionObserver and direct style manipulation */
.music-platform-badge { /* ADDED: Wrapper for platform icons + text */
transition: all 0.3s ease-in-out;
}
.music-platform-badge:hover {
transform: scale(1.05);
box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}
.music-platform-icon {
width: 36px; /* MODIFIED: Slightly smaller */
height: 36px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 18px; /* MODIFIED: Slightly smaller */
margin-right: 12px; /* MODIFIED: Adjusted margin */
}
.api-endpoint {
background-color: #f9fafb; /* MODIFIED: Slightly different bg */
border-left: 4px solid #3b82f6;
padding: 16px; /* MODIFIED: Adjusted padding */
border-radius: 0 8px 8px 0;
transition: all 0.3s ease-in-out;
border: 1px solid #e5e7eb; /* ADDED: Subtle border */
border-left-width: 4px; /* Keep colored border prominent */
}
.api-endpoint:hover {
background-color: #eff6ff;
transform: translateY(-3px); /* ADDED: Lift effect */
box-shadow: 0 6px 12px rgba(0,0,0,0.07); /* ADDED: Subtle shadow */
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
animation: tabFadeIn 0.5s ease-in-out; /* MODIFIED: Renamed and adjusted animation */
}
@keyframes tabFadeIn { /* ADDED: Specific animation for tab content */
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.tab-btn { /* ADDED: Base styling for tab button */
transition: all 0.3s ease-in-out;
padding-bottom: 8px; /* ADDED: Space for border */
border-bottom: 2px solid transparent; /* ADDED: Placeholder for border */
}
.tab-btn.active {
color: #3b82f6;
border-bottom-color: #3b82f6; /* MODIFIED: Use border-bottom-color */
font-weight: 500; /* ADDED: Slightly bolder active tab */
}
/* ADDED: Code block styling */
.code-block {
background-color: #1f2937; /* Tailwind gray-800 */
color: #d1d5db; /* Tailwind gray-300 */
padding: 1rem;
border-radius: 8px;
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 0.875rem;
line-height: 1.6;
overflow-x: auto;
box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* ADDED: Subtle shadow for code blocks */
}
.code-block code, .code-block pre {
background: transparent !important; /* Override any other background */
color: inherit !important;
}
</style>
</head>
<body class="antialiased">
<!-- Header -->
<header class="bg-white/80 backdrop-blur-md shadow-sm sticky top-0 z-50"> <!-- MODIFIED: Added backdrop-blur for glassy effect -->
<div class="container mx-auto px-6 py-4">
<div class="flex items-center justify-between">
<a href="#" class="flex items-center"> <!-- ADDED: Make logo a link -->
<i class="fas fa-music text-3xl text-blue-500 mr-3"></i> <!-- MODIFIED: Color -->
<h1 class="text-2xl font-bold gradient-text">Meting API</h1>
</a>
<nav id="main-nav" class="hidden md:flex md:items-center space-x-6 lg:space-x-8"> <!-- MODIFIED: id for JS, adjusted spacing -->
<a href="#features" class="nav-link text-gray-700 hover:text-blue-600 font-medium">功能特性</a>
<a href="#documentation" class="nav-link text-gray-700 hover:text-blue-600 font-medium">接口文档</a>
<a href="#examples" class="nav-link text-gray-700 hover:text-blue-600 font-medium">示例代码</a>
<a href="#authentication" class="nav-link text-gray-700 hover:text-blue-600 font-medium">鉴权说明</a>
</nav>
<button id="mobile-menu-button" class="md:hidden text-gray-700 hover:text-blue-600 focus:outline-none" aria-label="Toggle menu"> <!-- MODIFIED: id and aria-label -->
<i id="menu-icon" class="fas fa-bars text-2xl"></i> <!-- MODIFIED: id for icon change -->
</button>
</div>
</div>
<!-- Mobile Menu Container -->
<div id="mobile-menu-container" class="hidden md:hidden bg-white shadow-xl absolute top-full left-0 right-0 z-40">
<a href="#features" class="block py-3 px-6 text-gray-700 hover:bg-blue-50 hover:text-blue-600">功能特性</a>
<a href="#documentation" class="block py-3 px-6 text-gray-700 hover:bg-blue-50 hover:text-blue-600">接口文档</a>
<a href="#examples" class="block py-3 px-6 text-gray-700 hover:bg-blue-50 hover:text-blue-600">示例代码</a>
<a href="#authentication" class="block py-3 px-6 text-gray-700 hover:bg-blue-50 hover:text-blue-600">鉴权说明</a>
</div>
</header>
<!-- Hero Section -->
<section class="py-20 lg:py-28"> <!-- MODIFIED: Increased padding -->
<div class="container mx-auto px-6 text-center">
<div class="max-w-4xl mx-auto">
<h1 class="text-4xl md:text-5xl lg:text-6xl font-bold mb-6">强大而优雅的<span class="gradient-text">音乐服务接口</span></h1> <!-- MODIFIED: Slightly larger on lg -->
<p class="text-lg md:text-xl text-gray-600 mb-10">支持多平台无缝集成,为您的应用提供全面的音乐服务能力</p>
<div class="flex flex-wrap justify-center gap-4 mb-12">
<!-- MODIFIED: Added music-platform-badge class for hover effect -->
<div class="music-platform-badge flex items-center bg-white px-4 py-2 rounded-full shadow-md">
<div class="music-platform-icon bg-red-500"><i class="fab fa-napster"></i></div>
<span class="text-gray-700 font-medium">网易云音乐</span>
</div>
<div class="music-platform-badge flex items-center bg-white px-4 py-2 rounded-full shadow-md">
<div class="music-platform-icon bg-blue-500"><i class="fab fa-qq"></i></div>
<span class="text-gray-700 font-medium">QQ音乐</span>
</div>
<div class="music-platform-badge flex items-center bg-white px-4 py-2 rounded-full shadow-md">
<div class="music-platform-icon bg-green-500"><i class="fas fa-headphones-alt"></i></div> <!-- MODIFIED: Icon for Kugou -->
<span class="text-gray-700 font-medium">酷狗音乐</span>
</div>
<div class="music-platform-badge flex items-center bg-white px-4 py-2 rounded-full shadow-md">
<div class="music-platform-icon bg-purple-500"><i class="fas fa-compact-disc"></i></div> <!-- MODIFIED: Icon for Kuwo -->
<span class="text-gray-700 font-medium">酷我音乐</span>
</div>
</div>
<div>
<a href="#documentation" class="btn-primary text-white font-semibold py-3 px-10 rounded-full inline-block text-lg">开始使用</a> <!-- MODIFIED: font-semibold, px-10, text-lg -->
</div>
</div>
</div>
</section>
<!-- Features Section -->
<section id="features" class="py-16 bg-white">
<div class="container mx-auto px-6">
<h2 class="text-3xl lg:text-4xl font-bold text-center mb-16">核心<span class="gradient-text">功能特性</span></h2>
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-8"> <!-- MODIFIED: md:grid-cols-2 for better spacing on medium screens -->
<div class="card p-8 fade-in">
<div class="text-blue-500 mb-4">
<i class="fas fa-bolt text-4xl"></i>
</div>
<h3 class="text-xl font-bold mb-3 text-gray-800">多平台支持</h3>
<p class="text-gray-600">集成网易云音乐、QQ音乐、酷狗音乐、酷我音乐四大平台,一站式解决音乐服务需求。</p>
</div>
<div class="card p-8 fade-in" style="animation-delay: 0.15s;"> <!-- MODIFIED: animation-delay if using CSS animations -->
<div class="text-blue-500 mb-4">
<i class="fas fa-shield-alt text-4xl"></i>
</div>
<h3 class="text-xl font-bold mb-3 text-gray-800">安全鉴权</h3>
<p class="text-gray-600">采用HMAC-SHA256签名算法,包含时间戳和随机数,有效防止重放攻击。</p>
</div>
<div class="card p-8 fade-in md:col-span-2 lg:col-span-1" style="animation-delay: 0.3s;"> <!-- MODIFIED: Spanning for 2-col layout -->
<div class="text-blue-500 mb-4">
<i class="fas fa-tachometer-alt text-4xl"></i>
</div>
<h3 class="text-xl font-bold mb-3 text-gray-800">高性能</h3>
<p class="text-gray-600">优化的接口设计,毫秒级响应,支持高并发请求,满足各种业务场景需求。</p>
</div>
</div>
</div>
</section>
<!-- Documentation Section -->
<section id="documentation" class="py-16 bg-gray-50"> <!-- MODIFIED: bg-gray-50 to bg-slate-50 (Tailwind v3+) or keep bg-gray-50 -->
<div class="container mx-auto px-6">
<h2 class="text-3xl lg:text-4xl font-bold text-center mb-12">接口<span class="gradient-text">文档</span></h2>
<div class="max-w-5xl mx-auto"> <!-- MODIFIED: max-w-5xl for wider content area -->
<div class="flex border-b border-gray-300 mb-8 justify-center"> <!-- MODIFIED: Centered tabs -->
<button class="tab-btn py-3 px-6 font-medium text-gray-600 hover:text-blue-600 active" onclick="openTab(event, 'parameters')">接口参数</button>
<button class="tab-btn py-3 px-6 font-medium text-gray-600 hover:text-blue-600" onclick="openTab(event, 'endpoints')">API端点</button>
<button class="tab-btn py-3 px-6 font-medium text-gray-600 hover:text-blue-600" onclick="openTab(event, 'responses')">返回示例</button>
</div>
<div id="parameters" class="tab-content active">
<div class="card p-6 mb-6">
<h3 class="text-xl font-bold mb-4 flex items-center text-gray-800">
<i class="fas fa-sliders-h text-blue-500 mr-3"></i> 基本参数
</h3>
<div class="overflow-x-auto">
<table class="min-w-full bg-white">
<thead class="bg-gray-100">
<tr>
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 uppercase">参数</th>
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 uppercase">可选值</th>
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 uppercase">说明</th>
</tr>
</thead>
<tbody>
<tr class="border-b border-gray-200">
<td class="py-3 px-4 font-medium text-gray-700">server</td>
<td class="py-3 px-4 text-blue-600">netease, tencent, kugou, kuwo</td>
<td class="py-3 px-4 text-gray-600">数据源,默认为netease</td>
</tr>
<tr class="border-b border-gray-200">
<td class="py-3 px-4 font-medium text-gray-700">type</td>
<td class="py-3 px-4 text-blue-600">name, artist, url, pic, lrc, song, playlist</td>
<td class="py-3 px-4 text-gray-600">请求类型,如获取URL、歌词、封面等</td>
</tr>
<tr>
<td class="py-3 px-4 font-medium text-gray-700">id</td>
<td class="py-3 px-4 text-gray-500">-</td>
<td class="py-3 px-4 text-gray-600">歌曲或歌单ID</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="endpoints" class="tab-content">
<div class="space-y-6">
<div class="api-endpoint card"> <!-- MODIFIED: added card class to share hover effects if desired, or keep distinct -->
<div class="flex items-start">
<div class="bg-blue-100 text-blue-600 rounded-full p-3 mr-4 mt-1"> <!-- MODIFIED: color, padding -->
<i class="fas fa-link text-lg"></i>
</div>
<div>
<h4 class="font-bold text-lg mb-1 text-gray-800">获取音乐URL</h4>
<p class="text-gray-600 mb-3 text-sm">获取指定歌曲的播放地址(需要鉴权)</p>
<div class="code-block"> <!-- MODIFIED: Use .code-block class -->
<code>GET https://api.ixingchen.org.cn/unms/u/?type=url&id=416892104&auth={SIGNATURE}|{TIMESTAMP}|{NONCE}</code>
</div>
</div>
</div>
</div>
<div class="api-endpoint card">
<div class="flex items-start">
<div class="bg-green-100 text-green-600 rounded-full p-3 mr-4 mt-1">
<i class="fas fa-info-circle text-lg"></i>
</div>
<div>
<h4 class="font-bold text-lg mb-1 text-gray-800">获取歌曲信息</h4>
<p class="text-gray-600 mb-3 text-sm">获取歌曲的详细信息,包括名称、歌手、封面等</p>
<div class="code-block">
<code>GET https://api.ixingchen.org.cn/unms/u/?type=song&id=591321</code>
</div>
</div>
</div>
</div>
<div class="api-endpoint card">
<div class="flex items-start">
<div class="bg-purple-100 text-purple-600 rounded-full p-3 mr-4 mt-1">
<i class="fas fa-list-alt text-lg"></i> <!-- MODIFIED: Icon -->
</div>
<div>
<h4 class="font-bold text-lg mb-1 text-gray-800">获取歌单</h4>
<p class="text-gray-600 mb-3 text-sm">获取指定歌单的所有歌曲列表</p>
<div class="code-block">
<code>GET https://api.ixingchen.org.cn/unms/u/?type=playlist&id=2619366284</code>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="responses" class="tab-content">
<div class="card p-6">
<h3 class="text-xl font-bold mb-4 flex items-center text-gray-800">
<i class="fas fa-code text-blue-500 mr-3"></i> 返回示例
</h3>
<div class="mb-6">
<h4 class="font-semibold mb-2 text-blue-600">获取歌曲信息响应</h4>
<div class="code-block"> <!-- MODIFIED: Use .code-block class -->
<pre>{
"code": 200,
"data": {
"name": "起风了",
"artist": "买辣椒也用券",
"url": "https://api.ixingchen.org.cn/unms/u/?type=url&id=416892104&auth=...",
"pic": "https://api.ixingchen.org.cn/unms/u/?type=pic&id=416892104&auth=...",
"lrc": "https://api.ixingchen.org.cn/unms/u/?type=lrc&id=416892104&auth=..."
}
}</pre>
</div>
</div>
<div>
<h4 class="font-semibold mb-2 text-blue-600">获取歌单响应</h4>
<div class="code-block"> <!-- MODIFIED: Use .code-block class -->
<pre>{
"code": 200,
"data": [
{
"id": "1363948882",
"name": "晴天",
"artist": "周杰伦",
"url": "https://api.ixingchen.org.cn/unms/u/?type=url&id=1363948882&auth=..."
},
{
"id": "1824045033",
"name": "七里香",
"artist": "周杰伦",
"url": "https://api.ixingchen.org.cn/unms/u/?type=url&id=1824045033&auth=..."
}
// ... more songs
]
}</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Authentication Section -->
<section id="authentication" class="py-16 bg-white">
<div class="container mx-auto px-6">
<h2 class="text-3xl lg:text-4xl font-bold text-center mb-12">鉴权<span class="gradient-text">说明</span></h2>
<div class="max-w-4xl mx-auto">
<div class="card p-8">
<div class="flex items-start mb-6">
<div class="bg-red-100 text-red-600 rounded-full p-3 mr-4 flex-shrink-0"> <!-- MODIFIED: color, padding -->
<i class="fas fa-lock text-xl"></i>
</div>
<div>
<h3 class="text-xl font-bold mb-2 text-gray-800">需要鉴权的API</h3>
<p class="text-gray-600 mb-4">以下API请求需要添加鉴权参数:</p>
<ul class="list-disc list-inside pl-1 space-y-2 text-gray-700"> <!-- MODIFIED: list-inside -->
<li>获取音乐URL (<code class="text-sm bg-gray-100 px-1 rounded">type=url</code>)</li>
<li>获取封面图片 (<code class="text-sm bg-gray-100 px-1 rounded">type=pic</code>)</li>
<li>获取歌词 (<code class="text-sm bg-gray-100 px-1 rounded">type=lrc</code>)</li>
</ul>
</div>
</div>
<!-- MODIFIED: Alert styling -->
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-6 rounded-md">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-exclamation-triangle text-yellow-500 mt-0.5"></i> <!-- MODIFIED: icon and margin -->
</div>
<div class="ml-3">
<p class="text-sm text-yellow-800">
鉴权参数有效期为<strong class="font-medium">300秒</strong>,过期后需要重新生成。
</p>
</div>
</div>
</div>
<div class="mb-6">
<h4 class="font-bold text-lg mb-3 text-gray-800">鉴权参数格式</h4>
<div class="code-block mb-3"> <!-- MODIFIED: Use .code-block class -->
<code>auth=签名|时间戳|随机数</code>
</div>
<p class="text-gray-600">签名由服务器使用HMAC-SHA256算法生成,包含时间戳和随机数以防止重放攻击。</p>
</div>
<div>
<h4 class="font-bold text-lg mb-3 text-gray-800">示例请求</h4>
<div class="code-block"> <!-- MODIFIED: Use .code-block class -->
<code>GET https://api.ixingchen.org.cn/unms/u/?type=url&id=416892104&auth={SIGNATURE}|{TIMESTAMP}|{NONCE}</code>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-slate-800 text-slate-300 py-12"> <!-- MODIFIED: Tailwind v3 slate colors, adjust if using older Tailwind -->
<div class="container mx-auto px-6">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-6 md:mb-0 text-center md:text-left">
<div class="flex items-center justify-center md:justify-start">
<i class="fas fa-music text-2xl text-blue-400 mr-3"></i>
<span class="text-xl font-bold text-white">Meting API</span>
</div>
<p class="text-slate-400 mt-2 text-sm">强大而优雅的音乐服务接口</p>
</div>
<div class="flex space-x-6">
<a href="#" class="text-slate-400 hover:text-blue-400 transition-colors duration-300" aria-label="GitHub">
<i class="fab fa-github text-2xl"></i>
</a>
<a href="#" class="text-slate-400 hover:text-blue-400 transition-colors duration-300" aria-label="Weixin">
<i class="fab fa-weixin text-2xl"></i>
</a>
<a href="#" class="text-slate-400 hover:text-blue-400 transition-colors duration-300" aria-label="Email">
<i class="fas fa-envelope text-2xl"></i>
</a>
</div>
</div>
<div class="border-t border-slate-700 mt-8 pt-8 text-center text-slate-400 text-sm">
<p>此API基于 <a href="https://github.com/metowolf/Meting" target="_blank" rel="noopener noreferrer" class="text-blue-400 hover:underline">Meting</a> 构建</p>
<p class="mt-2">© <script>document.write(new Date().getFullYear())</script> Meting API. All rights reserved.</p>
</div>
</div>
</footer>
<script>
// Tab functionality
function openTab(evt, tabName) {
const tabContents = document.getElementsByClassName("tab-content");
for (let i = 0; i < tabContents.length; i++) {
tabContents[i].classList.remove("active");
}
const tabButtons = document.getElementsByClassName("tab-btn");
for (let i = 0; i < tabButtons.length; i++) {
tabButtons[i].classList.remove("active");
}
document.getElementById(tabName).classList.add("active");
evt.currentTarget.classList.add("active");
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetElement = document.querySelector(this.getAttribute('href'));
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth'
});
}
// Close mobile menu if open after clicking a link
const mobileMenu = document.getElementById('mobile-menu-container');
const menuIcon = document.getElementById('menu-icon');
if (!mobileMenu.classList.contains('hidden')) {
mobileMenu.classList.add('hidden');
menuIcon.classList.remove('fa-times');
menuIcon.classList.add('fa-bars');
}
});
});
// Mobile menu toggle
const mobileMenuButton = document.getElementById('mobile-menu-button');
const mobileMenuContainer = document.getElementById('mobile-menu-container');
const menuIcon = document.getElementById('menu-icon');
if (mobileMenuButton && mobileMenuContainer && menuIcon) {
mobileMenuButton.addEventListener('click', function() {
mobileMenuContainer.classList.toggle('hidden');
if (mobileMenuContainer.classList.contains('hidden')) {
menuIcon.classList.remove('fa-times');
menuIcon.classList.add('fa-bars');
} else {
menuIcon.classList.remove('fa-bars');
menuIcon.classList.add('fa-times');
}
});
}
// Animation on scroll (Intersection Observer)
const fadeElements = document.querySelectorAll('.fade-in');
const fadeInObserver = new IntersectionObserver((entries, observer) => { // ADDED: observer parameter
entries.forEach(entry => {
if (entry.isIntersecting) {
// Use a timeout to allow CSS animation-delay to work if defined inline
// Or, directly apply transition with JS controlled delay
const delay = parseFloat(entry.target.style.animationDelay) * 1000 || 0;
setTimeout(() => {
entry.target.style.opacity = 1;
entry.target.style.transform = 'translateY(0)';
}, delay);
observer.unobserve(entry.target); // ADDED: Unobserve after animation
}
});
}, { threshold: 0.1 }); // Trigger when 10% of the element is visible
fadeElements.forEach(element => {
element.style.opacity = 0; // Initial state for JS transition
element.style.transform = 'translateY(20px)'; // Initial state
element.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out'; // JS driven transition
// Note: if you use CSS @keyframes, the JS above might conflict.
// The provided HTML had inline animation-delay, which works with CSS animations.
// This JS version makes the animation itself JS-driven.
fadeInObserver.observe(element);
});
// Active Nav Link highlighting on scroll (Optional, but nice for UX)
const sections = document.querySelectorAll("section[id]");
const navLinks = document.querySelectorAll("header nav a.nav-link");
window.addEventListener("scroll", () => {
let current = "";
sections.forEach((section) => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
// Adjust offset if header is sticky and tall
if (pageYOffset >= sectionTop - sectionHeight / 3 - 60) {
current = section.getAttribute("id");
}
});
navLinks.forEach((link) => {
link.classList.remove("active"); // Assumes .active class handles the underline via .nav-link.active::after
if (link.getAttribute("href") === `#${current}`) {
link.classList.add("active");
}
});
});
</script>
</body>
</html> |