superstar_v2/themes/superstar/_www/clicked-song.html

338 lines
9.7 KiB
HTML
Raw Permalink Normal View History

2025-05-19 15:09:57 +08:00
<!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 {
2025-06-24 10:35:01 +08:00
background: #D32F2F;
2025-05-19 15:09:57 +08:00
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;
}
.table-container {
margin-top: 20px;
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
}
th {
background-color: #333;
color: white;
}
tr:nth-child(odd) {
background-color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
tr:hover {
background-color: #666;
}
td {
color: black;
}
.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;
}
.content {
margin: 20px;
}
.image-container {
text-align: center;
margin-top: 20px;
}
.image-container img {
max-width: 100%;
height: auto;
}
a {
text-decoration: none;
color: inherit;
}
input,
button {
pointer-events: auto !important;
cursor: text !important;
}
button {
cursor: pointer !important;
}
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.form-group button,
.song-details button {
border: none;
background-color: #D32F2F;
color: white;
padding: 10px 20px;
border-radius: 5px;
font-size: 16px;
transition: background-color 0.3s;
}
.form-group button:hover,
.song-details button:hover {
background-color: #b52b2b;
}
/* 防止表格內容被選中 */
#results-table {
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
#results-table tbody tr {
cursor: pointer;
}
</style>
</head>
<body>
<div class="header">已點歌曲</div>
<!-- Add Banner -->
<div class="banner">
<img src="手機點歌/BANNER-07.png" alt="超級巨星 Banner" onclick="refreshPage()">
</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="table-container">
<table id="results-table">
<thead>
<tr>
<th>歌名</th>
<th>歌手</th>
<th>狀態</th>
</tr>
</thead>
<tbody>
<!-- 搜索結果將顯示在這裡 -->
</tbody>
</table>
</div>
<div class="image-container">
<img src="手機點歌/BG-3-04.png" alt="Wolf Fox Logo">
</div>
</div>
<script>
// 首先處理導航 - 確保最高優先級
document.addEventListener('DOMContentLoaded', function() {
// 導航處理
const menuLinks = document.querySelectorAll('.menu-link');
menuLinks.forEach(link => {
// 移除所有現有的事件監聽器
const oldLink = link.cloneNode(true);
link.parentNode.replaceChild(oldLink, link);
// 添加新的點擊處理
oldLink.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
const href = this.getAttribute('href');
if (href) {
window.location.href = href;
}
}, true); // 使用捕獲階段
});
// 菜單切換
const menuToggle = document.querySelector('.menu-toggle');
const menu = document.querySelector('.menu');
if (menuToggle && menu) {
menuToggle.addEventListener('click', (e) => {
e.stopPropagation();
e.stopImmediatePropagation();
menu.classList.toggle('active');
}, true);
document.addEventListener('click', (e) => {
if (!menu.contains(e.target) && !menuToggle.contains(e.target)) {
menu.classList.remove('active');
}
}, true);
}
});
function fetchUserPlaylist() {
fetch('/ordered-song', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
.then(response => {
if (response.ok) {
return response.json();
} else if (response.status === 204) {
console.log('No content in user playlist');
return [];
} else {
throw new Error('Failed to fetch playlist');
}
})
.then(data => {
const tableBody = document.querySelector('#results-table tbody');
tableBody.innerHTML = '';
if (Array.isArray(data.playingSongList)) {
data.playingSongList.forEach(song => {
const row = document.createElement('tr');
const songNameCell = document.createElement('td');
const artistCell = document.createElement('td');
const playStateCell = document.createElement('td');
songNameCell.textContent = song.Song;
artistCell.textContent = song.ArtistA;
playStateCell.textContent = song.PlayState;
row.appendChild(songNameCell);
row.appendChild(artistCell);
row.appendChild(playStateCell);
tableBody.appendChild(row);
});
} else {
console.error('Expected playingSongList to be an array');
}
})
.catch(error => {
console.error('Error:', error);
});
}
function refreshPage() {
location.reload();
}
window.onload = fetchUserPlaylist;
document.querySelectorAll('form').forEach(form => {
form.addEventListener('submit', (e) => {
e.preventDefault();
});
});
document.querySelectorAll('button').forEach(button => {
button.addEventListener('click', (e) => {
e.preventDefault();
if(button.onclick) {
button.onclick.call(this);
}
});
});
// 添加全局點擊事件處理
document.addEventListener('click', function(e) {
if (e.target.tagName === 'INPUT' ||
e.target.tagName === 'BUTTON' ||
e.target.closest('tr')) {
return;
}
e.preventDefault();
}, true);
</script>
</body>
</html>