superstar_v2/themes/superstar/_www/sound-control.html
2025-06-18 13:43:17 +08:00

298 lines
9.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>聲音控制</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
text-align: center;
margin: 20px;
}
.header {
background: #FFA500;
padding: 10px 0;
color: white;
font-size: 24px;
font-weight: 500;
text-align: center;
}
.banner {
width: 100%;
max-width: 600px;
margin: 0 auto 20px;
}
.banner img {
width: 100%;
height: auto;
}
.menu-toggle {
position: absolute;
top: 10px;
left: 10px;
cursor: pointer;
}
.menu {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 250px;
background: white;
transform: translateX(-250px);
transition: transform 0.3s ease;
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
overflow-y: auto;
}
.menu.active {
transform: translateX(0);
}
.menu ul {
list-style: none;
padding: 0;
margin: 0;
}
.menu ul li {
padding: 15px 20px;
border-bottom: 1px solid #ccc;
}
.menu ul li a {
text-decoration: none;
color: #333;
display: block;
}
.menu ul li a:hover {
background: #eee;
}
.container {
margin: 20px;
}
.button-container {
max-width: 600px;
margin: 0 auto;
}
.content {
display: grid;
grid-template-columns: repeat(3, 1fr); /* 固定3欄 */
gap: 5px; /* 移除格子之間的空隙 */
margin: 0; /* 沒有外邊距 */
padding: 0; /* 沒有內邊距 */
width: 36.5vw; /* 滿版寬度 */
}
@media (max-width: 600px) {
.content {
display: grid;
grid-template-columns: repeat(3, 1fr); /* 固定3欄 */
gap: 5px; /* 移除格子之間的空隙 */
margin: 0; /* 沒有外邊距 */
padding: 0; /* 沒有內邊距 */
width: 78vw; /* 滿版寬度 */
}
}
.card {
background: linear-gradient(135deg, #FF4081, #FF4081);
color: white;
width: 130px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
overflow: hidden;
cursor: pointer;
}
.card:hover {
transform: scale(1.05);
}
.card img {
max-width: 100%;
max-height: 100%;
object-fit: cover;
}
.section {
display: none;
}
.section.active {
display: block;
}
a {
text-decoration: none;
color: inherit;
}
input,
button {
pointer-events: auto;
cursor: text;
}
button {
cursor: pointer;
}
.card {
pointer-events: auto !important;
cursor: pointer !important;
}
/* 防止表格內容被選中 */
.content {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
</style>
</head>
<body>
<div class="header">聲音控制</div>
<!-- Add Banner -->
<div class="banner">
<img src="手機點歌/BANNER-09.png" alt="超級巨星 Banner">
</div>
<div class="menu-toggle">
<svg height="32px" id="Layer_1" style="enable-background:new 0 0 32 32;" version="1.1" viewBox="0 0 32 32" width="32px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path d="M4,10h24c0.553,0,1-0.447,1-1s-0.447-1-1-1H4c-0.553,0-1,0.447-1,1S3.447,10,4,10z"/><path d="M28,15H4c-0.553,0-1,0.447-1,1s0.447,1,1,1h24c0.553,0,1-0.447,1-1S28.553,15,28,15z"/><path d="M28,22H4c-0.553,0-1,0.447-1,1s0.447,1,1,1h24c0.553,0,1-0.447,1-1S28.553,22,28,22z"/></svg>
</div>
<div class="menu">
<ul>
<li><a href="windows.html" class="menu-link">首頁</a></li>
<li><a href="new-songs.html" class="menu-link">新歌快報</a></li>
<li><a href="top-ranking.html" class="menu-link">熱門排行</a></li>
<li><a href="search-singer.html" class="menu-link">歌星查詢</a></li>
<li><a href="search-song.html" class="menu-link">歌名查詢</a></li>
<li><a href="clicked-song.html" class="menu-link">已點歌曲</a></li>
<!-- <!-- //<li><a href="my-favorite.html" class="menu-link">我的最愛</a></li> --> -->
<li><a href="sound-control.html" class="menu-link">聲音控制</a></li>
<li><a href="social-media.html" class="menu-link">社群媒體</a></li>
<li><a href="love-message.html" class="menu-link">真情告白</a></li>
<li><a href="mood-stickers.html" class="menu-link">心情貼圖</a></li>
</ul>
</div>
<div class="container">
<div class="button-container">
<div class="content">
<div class="card" onclick="sendVolumeControl('pause')">
<img src="手機點歌/音控_工作區域 1.jpg" alt="Pause">
</div>
<div class="card" onclick="sendVolumeControl('volume_up')">
<img src="手機點歌/音控-02.jpg" alt="Music Up">
</div>
<div class="card" onclick="sendVolumeControl('mic_up')">
<img src="手機點歌/音控-04.jpg" alt="Mic Up">
</div>
<div class="card" onclick="sendVolumeControl('mute')">
<img src="手機點歌/音控-06.jpg" alt="Mute">
</div>
<div class="card" onclick="sendVolumeControl('volume_down')">
<img src="手機點歌/音控-03.jpg" alt="Music Down">
</div>
<div class="card" onclick="sendVolumeControl('mic_down')">
<img src="手機點歌/音控-05.jpg" alt="Mic Down">
</div>
<div class="card" onclick="sendVolumeControl('original_song')">
<img src="手機點歌/音控-07.jpg" alt="Original Song">
</div>
<div class="card" onclick="sendVolumeControl('service')">
<img src="手機點歌/音控-08.jpg" alt="Service">
</div>
<div class="card" onclick="sendVolumeControl('replay')">
<img src="手機點歌/音控-09.jpg" alt="Replay">
</div>
<div class="card" onclick="sendVolumeControl('male_key')">
<img src="手機點歌/音控-11.jpg" alt="Male Key">
</div>
<div class="card" onclick="sendVolumeControl('female_key')">
<img src="手機點歌/音控-12.jpg" alt="Female Key">
</div>
<div class="card" onclick="sendVolumeControl('cut')">
<img src="手機點歌/音控-10.jpg" alt="Cut">
</div>
<div class="card" onclick="sendVolumeControl('lower_key')">
<img src="手機點歌/音控-15.jpg" alt="Lower Key">
</div>
<div class="card" onclick="sendVolumeControl('standard_key')">
<img src="手機點歌/音控-14.jpg" alt="Standard Key">
</div>
<div class="card" onclick="sendVolumeControl('raise_key')">
<img src="手機點歌/音控-13.jpg" alt="Raise Key">
</div>
</div>
</div>
</div>
<script>
const menuToggle = document.querySelector('.menu-toggle');
const menu = document.querySelector('.menu');
menuToggle.addEventListener('click', (e) => {
e.stopPropagation();
menu.classList.toggle('active');
});
document.addEventListener('click', (e) => {
if (!menu.contains(e.target) && !menuToggle.contains(e.target)) {
menu.classList.remove('active');
}
});
// 修改發送命令的函數
async function sendVolumeControl(command) {
try {
const response = await fetch('/sound-control', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({ command: command })
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log('Command sent successfully:', command);
console.log('Response:', data);
} catch (error) {
console.error('Failed to send command:', error);
}
}
// 重新綁定卡片點擊事件
document.querySelectorAll('.card').forEach(card => {
// 移除舊的onclick屬性
const command = card.getAttribute('onclick');
if (command) {
const match = command.match(/sendVolumeControl\('(.+?)'\)/);
if (match) {
const cmd = match[1];
card.removeAttribute('onclick');
// 使用單個點擊事件監聽器
card.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
console.log('Card clicked:', cmd);
sendVolumeControl(cmd);
});
}
}
});
</script>
</body>
</html>