|
|
<!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; |
|
|
|
|
|
background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%); |
|
|
min-height: 100vh; |
|
|
color: #374151; |
|
|
} |
|
|
|
|
|
.card { |
|
|
transition: all 0.3s ease-in-out; |
|
|
box-shadow: 0 8px 16px rgba(0,0,0,0.08); |
|
|
border-radius: 12px; |
|
|
overflow: hidden; |
|
|
background: rgba(255,255,255,0.95); |
|
|
backdrop-filter: blur(8px); |
|
|
} |
|
|
|
|
|
.card:hover { |
|
|
transform: translateY(-6px); |
|
|
box-shadow: 0 12px 24px rgba(0,0,0,0.12); |
|
|
} |
|
|
|
|
|
.gradient-text { |
|
|
background: linear-gradient(90deg, #3b82f6, #8b5cf6); |
|
|
-webkit-background-clip: text; |
|
|
background-clip: text; |
|
|
color: transparent; |
|
|
} |
|
|
|
|
|
.nav-link { |
|
|
position: relative; |
|
|
padding-bottom: 4px; |
|
|
} |
|
|
|
|
|
.nav-link::after { |
|
|
content: ''; |
|
|
position: absolute; |
|
|
width: 0; |
|
|
height: 2px; |
|
|
bottom: 0; |
|
|
left: 50%; |
|
|
transform: translateX(-50%); |
|
|
background-color: #3b82f6; |
|
|
transition: width 0.3s ease-in-out; |
|
|
} |
|
|
|
|
|
.nav-link:hover::after, .nav-link.active::after { |
|
|
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); |
|
|
} |
|
|
|
|
|
.btn-primary:hover { |
|
|
transform: translateY(-3px); |
|
|
box-shadow: 0 7px 20px rgba(59, 130, 246, 0.45); |
|
|
} |
|
|
|
|
|
.fade-in { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.music-platform-badge { |
|
|
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; |
|
|
height: 36px; |
|
|
border-radius: 8px; |
|
|
display: flex; |
|
|
align-items: center; |
|
|
justify-content: center; |
|
|
color: white; |
|
|
font-size: 18px; |
|
|
margin-right: 12px; |
|
|
} |
|
|
|
|
|
.api-endpoint { |
|
|
background-color: #f9fafb; |
|
|
border-left: 4px solid #3b82f6; |
|
|
padding: 16px; |
|
|
border-radius: 0 8px 8px 0; |
|
|
transition: all 0.3s ease-in-out; |
|
|
border: 1px solid #e5e7eb; |
|
|
border-left-width: 4px; |
|
|
} |
|
|
|
|
|
.api-endpoint:hover { |
|
|
background-color: #eff6ff; |
|
|
transform: translateY(-3px); |
|
|
box-shadow: 0 6px 12px rgba(0,0,0,0.07); |
|
|
} |
|
|
|
|
|
.tab-content { |
|
|
display: none; |
|
|
} |
|
|
|
|
|
.tab-content.active { |
|
|
display: block; |
|
|
animation: tabFadeIn 0.5s ease-in-out; |
|
|
} |
|
|
|
|
|
@keyframes tabFadeIn { |
|
|
from { opacity: 0; transform: translateY(10px); } |
|
|
to { opacity: 1; transform: translateY(0); } |
|
|
} |
|
|
|
|
|
.tab-btn { |
|
|
transition: all 0.3s ease-in-out; |
|
|
padding-bottom: 8px; |
|
|
border-bottom: 2px solid transparent; |
|
|
} |
|
|
|
|
|
.tab-btn.active { |
|
|
color: #3b82f6; |
|
|
border-bottom-color: #3b82f6; |
|
|
font-weight: 500; |
|
|
} |
|
|
|
|
|
.code-block { |
|
|
background-color: #1f2937; |
|
|
color: #d1d5db; |
|
|
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); |
|
|
} |
|
|
.code-block code, .code-block pre { |
|
|
background: transparent !important; |
|
|
color: inherit !important; |
|
|
} |
|
|
</style> |
|
|
</head> |
|
|
<body class="antialiased"> |
|
|
|
|
|
<header class="bg-white/80 backdrop-blur-md shadow-sm sticky top-0 z-50"> |
|
|
<div class="container mx-auto px-6 py-4"> |
|
|
<div class="flex items-center justify-between"> |
|
|
<a href="#" class="flex items-center"> |
|
|
<i class="fas fa-music text-3xl text-blue-500 mr-3"></i> |
|
|
<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"> |
|
|
<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"> |
|
|
<i id="menu-icon" class="fas fa-bars text-2xl"></i> |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<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> |
|
|
|
|
|
|
|
|
<section class="py-20 lg:py-28"> |
|
|
<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> |
|
|
<p class="text-lg md:text-xl text-gray-600 mb-10">支持多平台无缝集成,为您的应用提供全面的音乐服务能力</p> |
|
|
<div class="flex flex-wrap justify-center gap-4 mb-12"> |
|
|
|
|
|
<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> |
|
|
<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> |
|
|
<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> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</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"> |
|
|
<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;"> |
|
|
<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;"> |
|
|
<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> |
|
|
|
|
|
|
|
|
<section id="documentation" class="py-16 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"> |
|
|
<div class="flex border-b border-gray-300 mb-8 justify-center"> |
|
|
<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"> |
|
|
<div class="flex items-start"> |
|
|
<div class="bg-blue-100 text-blue-600 rounded-full p-3 mr-4 mt-1"> |
|
|
<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"> |
|
|
<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> |
|
|
</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"> |
|
|
<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"> |
|
|
<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> |
|
|
|
|
|
|
|
|
<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"> |
|
|
<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"> |
|
|
<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> |
|
|
|
|
|
|
|
|
<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> |
|
|
</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"> |
|
|
<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"> |
|
|
<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 class="bg-slate-800 text-slate-300 py-12"> |
|
|
<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> |
|
|
|
|
|
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"); |
|
|
} |
|
|
|
|
|
|
|
|
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' |
|
|
}); |
|
|
} |
|
|
|
|
|
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'); |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
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'); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
const fadeElements = document.querySelectorAll('.fade-in'); |
|
|
|
|
|
const fadeInObserver = new IntersectionObserver((entries, observer) => { |
|
|
entries.forEach(entry => { |
|
|
if (entry.isIntersecting) { |
|
|
|
|
|
|
|
|
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); |
|
|
} |
|
|
}); |
|
|
}, { threshold: 0.1 }); |
|
|
|
|
|
fadeElements.forEach(element => { |
|
|
element.style.opacity = 0; |
|
|
element.style.transform = 'translateY(20px)'; |
|
|
element.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out'; |
|
|
|
|
|
|
|
|
|
|
|
fadeInObserver.observe(element); |
|
|
}); |
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
if (pageYOffset >= sectionTop - sectionHeight / 3 - 60) { |
|
|
current = section.getAttribute("id"); |
|
|
} |
|
|
}); |
|
|
|
|
|
navLinks.forEach((link) => { |
|
|
link.classList.remove("active"); |
|
|
if (link.getAttribute("href") === `#${current}`) { |
|
|
link.classList.add("active"); |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
</script> |
|
|
</body> |
|
|
</html> |