577 lines
18 KiB
HTML
577 lines
18 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;
|
||
|
}
|
||
|
.content {
|
||
|
margin: 20px;
|
||
|
}
|
||
|
.form-container {
|
||
|
margin: 20px auto;
|
||
|
text-align: left;
|
||
|
max-width: 600px;
|
||
|
}
|
||
|
.form-group {
|
||
|
margin-bottom: 15px;
|
||
|
}
|
||
|
.form-group label {
|
||
|
margin-right: 10px;
|
||
|
}
|
||
|
.form-group input {
|
||
|
width: 300px;
|
||
|
padding: 8px;
|
||
|
box-sizing: border-box;
|
||
|
}
|
||
|
.form-group button {
|
||
|
padding: 10px 20px;
|
||
|
background: #D32F2F;
|
||
|
color: white;
|
||
|
border: none;
|
||
|
cursor: pointer;
|
||
|
display: block;
|
||
|
margin: 0 auto;
|
||
|
}
|
||
|
.form-group button:hover {
|
||
|
background: #b52b2b;
|
||
|
}
|
||
|
.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;
|
||
|
}
|
||
|
.song-details {
|
||
|
position: fixed;
|
||
|
top: 50%;
|
||
|
left: 50%;
|
||
|
transform: translate(-50%, -50%);
|
||
|
background-color: white;
|
||
|
border-radius: 10px;
|
||
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
||
|
padding: 20px;
|
||
|
z-index: 1002;
|
||
|
width: 90%;
|
||
|
max-width: 400px;
|
||
|
text-align: left;
|
||
|
display: none;
|
||
|
}
|
||
|
|
||
|
.overlay {
|
||
|
position: fixed;
|
||
|
top: 0;
|
||
|
left: 0;
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
background-color: rgba(0, 0, 0, 0.5);
|
||
|
backdrop-filter: blur(5px);
|
||
|
z-index: 999;
|
||
|
display: none;
|
||
|
}
|
||
|
.song-details button {
|
||
|
width: 100%;
|
||
|
padding: 10px;
|
||
|
margin: 10px 0;
|
||
|
background-color: #D32F2F;
|
||
|
color: white;
|
||
|
border: none;
|
||
|
border-radius: 5px;
|
||
|
cursor: pointer;
|
||
|
font-size: 16px;
|
||
|
transition: background-color 0.3s;
|
||
|
}
|
||
|
|
||
|
.song-details button:hover {
|
||
|
background-color: #b52b2b;
|
||
|
}
|
||
|
|
||
|
.close-btn {
|
||
|
position: absolute;
|
||
|
top: 10px;
|
||
|
right: 10px;
|
||
|
font-size: 24px;
|
||
|
color: #333;
|
||
|
cursor: pointer;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
|
||
|
.close-btn:hover {
|
||
|
color: #D32F2F;
|
||
|
}
|
||
|
.image-container {
|
||
|
text-align: center;
|
||
|
margin-top: 20px;
|
||
|
}
|
||
|
.image-container img {
|
||
|
max-width: 100%;
|
||
|
height: auto;
|
||
|
}
|
||
|
a {
|
||
|
text-decoration: none;
|
||
|
color: inherit;
|
||
|
}
|
||
|
|
||
|
input,
|
||
|
button,
|
||
|
.card,
|
||
|
|
||
|
button {
|
||
|
-webkit-appearance: none;
|
||
|
-moz-appearance: none;
|
||
|
appearance: none;
|
||
|
}
|
||
|
|
||
|
input[type="text"] {
|
||
|
-webkit-appearance: none;
|
||
|
-moz-appearance: none;
|
||
|
appearance: none;
|
||
|
pointer-events: auto !important;
|
||
|
}
|
||
|
|
||
|
/* 防止表格內容被選中 */
|
||
|
#results-table {
|
||
|
user-select: none;
|
||
|
-webkit-user-select: none;
|
||
|
-moz-user-select: none;
|
||
|
-ms-user-select: none;
|
||
|
}
|
||
|
|
||
|
#results-table tbody tr {
|
||
|
cursor: pointer;
|
||
|
}
|
||
|
|
||
|
@media (max-width: 768px) {
|
||
|
.song-details {
|
||
|
width: 95%;
|
||
|
padding: 15px;
|
||
|
}
|
||
|
|
||
|
.song-details button {
|
||
|
padding: 12px;
|
||
|
margin: 8px 0;
|
||
|
font-size: 16px;
|
||
|
}
|
||
|
|
||
|
.close-btn {
|
||
|
padding: 10px;
|
||
|
}
|
||
|
|
||
|
.table-container {
|
||
|
margin-top: 10px;
|
||
|
font-size: 14px;
|
||
|
}
|
||
|
|
||
|
th, td {
|
||
|
padding: 8px 4px;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#results-table tbody tr {
|
||
|
cursor: pointer;
|
||
|
-webkit-tap-highlight-color: rgba(211, 47, 47, 0.1);
|
||
|
}
|
||
|
|
||
|
#results-table tbody tr:active {
|
||
|
background-color: rgba(211, 47, 47, 0.2);
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<div class="header">歌星查詢</div>
|
||
|
|
||
|
<!-- Add Banner -->
|
||
|
<div class="banner">
|
||
|
<img src="手機點歌/BANNER-05.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="form-container">
|
||
|
<div class="form-group">
|
||
|
<label for="singer-name">歌手名稱</label>
|
||
|
<input type="text" id="singer-name" name="singer-name">
|
||
|
</div>
|
||
|
<div class="form-group">
|
||
|
<button type="submit" onclick="submitSearch('singer')">送出查詢</button>
|
||
|
</div>
|
||
|
</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="手機點歌/LOGO_800x400px.png" alt="Wolf Fox Logo">
|
||
|
</div>
|
||
|
<div class="song-details" id="song-details" style="display:none;">
|
||
|
<span class="close-btn" id="close-btn">×</span>
|
||
|
<p>歌名:<span id="detail-song-name"></span></p>
|
||
|
<p>編號:<span id="detail-song-number"></span></p>
|
||
|
<p>歌手:<span id="detail-singer"></span></p>
|
||
|
<p>語別:<span id="detail-language"></span></p>
|
||
|
<button id="order-song-button">包廂點歌</button>
|
||
|
<button id="insert-song-button">插播歌曲</button>
|
||
|
</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', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
e.stopImmediatePropagation();
|
||
|
menu.classList.toggle('active');
|
||
|
}, true);
|
||
|
|
||
|
// 點擊其他區域關閉菜單
|
||
|
document.addEventListener('click', function(e) {
|
||
|
if (!menu.contains(e.target) && !menuToggle.contains(e.target)) {
|
||
|
menu.classList.remove('active');
|
||
|
}
|
||
|
}, true);
|
||
|
}
|
||
|
|
||
|
// 處理搜索結果點擊
|
||
|
const resultsTable = document.getElementById('results-table');
|
||
|
if (resultsTable) {
|
||
|
resultsTable.addEventListener('click', function(e) {
|
||
|
const row = e.target.closest('tr');
|
||
|
if (!row || !row.cells) return;
|
||
|
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
|
||
|
const song = {
|
||
|
Song: row.cells[0].textContent,
|
||
|
ArtistA: row.cells[1].textContent,
|
||
|
Category: row.cells[2].textContent,
|
||
|
SongNumber: row.cells[3].textContent,
|
||
|
SongFilePathHost1: row.cells[4].textContent,
|
||
|
SongFilePathHost2: row.cells[5].textContent
|
||
|
};
|
||
|
|
||
|
window.selectedSong = song;
|
||
|
document.getElementById('detail-song-name').textContent = song.Song;
|
||
|
document.getElementById('detail-song-number').textContent = song.SongNumber;
|
||
|
document.getElementById('detail-singer').textContent = song.ArtistA;
|
||
|
document.getElementById('detail-language').textContent = song.Category;
|
||
|
|
||
|
document.getElementById('song-details').style.display = 'block';
|
||
|
document.getElementById('overlay').style.display = 'block';
|
||
|
}, true);
|
||
|
}
|
||
|
|
||
|
// 處理關閉按鈕
|
||
|
const closeBtn = document.getElementById('close-btn');
|
||
|
if (closeBtn) {
|
||
|
closeBtn.addEventListener('click', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
hideDetails();
|
||
|
}, true);
|
||
|
}
|
||
|
|
||
|
// 處理遮罩層點擊
|
||
|
const overlay = document.getElementById('overlay');
|
||
|
if (overlay) {
|
||
|
overlay.addEventListener('click', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
hideDetails();
|
||
|
}, true);
|
||
|
}
|
||
|
|
||
|
// 處理點歌按鈕
|
||
|
const orderSongButton = document.getElementById('order-song-button');
|
||
|
if (orderSongButton) {
|
||
|
orderSongButton.addEventListener('click', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
|
||
|
const song = window.selectedSong;
|
||
|
if (!song) return;
|
||
|
|
||
|
fetch('/order-song', {
|
||
|
method: 'POST',
|
||
|
headers: {
|
||
|
'Content-Type': 'application/json;charset=UTF-8'
|
||
|
},
|
||
|
body: JSON.stringify(song)
|
||
|
})
|
||
|
.then(response => response.json())
|
||
|
.then(data => {
|
||
|
alert('點歌成功!');
|
||
|
hideDetails();
|
||
|
})
|
||
|
.catch(error => {
|
||
|
console.error('Error:', error);
|
||
|
});
|
||
|
}, true);
|
||
|
}
|
||
|
|
||
|
// 處理插播按鈕
|
||
|
const insertSongButton = document.getElementById('insert-song-button');
|
||
|
if (insertSongButton) {
|
||
|
insertSongButton.addEventListener('click', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
|
||
|
const song = window.selectedSong;
|
||
|
if (!song) return;
|
||
|
|
||
|
fetch('/insert-song', {
|
||
|
method: 'POST',
|
||
|
headers: {
|
||
|
'Content-Type': 'application/json;charset=UTF-8'
|
||
|
},
|
||
|
body: JSON.stringify(song)
|
||
|
})
|
||
|
.then(response => response.json())
|
||
|
.then(data => {
|
||
|
alert('插播成功!');
|
||
|
hideDetails();
|
||
|
})
|
||
|
.catch(error => {
|
||
|
console.error('Error:', error);
|
||
|
});
|
||
|
}, true);
|
||
|
}
|
||
|
|
||
|
// 處理搜索表單
|
||
|
const searchForm = document.querySelector('.form-group');
|
||
|
if (searchForm) {
|
||
|
const searchInput = document.getElementById('singer-name');
|
||
|
const searchButton = searchForm.querySelector('button');
|
||
|
|
||
|
if (searchInput) {
|
||
|
searchInput.addEventListener('click', function(e) {
|
||
|
e.stopPropagation();
|
||
|
}, true);
|
||
|
|
||
|
searchInput.addEventListener('touchstart', function(e) {
|
||
|
e.stopPropagation();
|
||
|
}, true);
|
||
|
}
|
||
|
|
||
|
if (searchButton) {
|
||
|
searchButton.addEventListener('click', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
submitSearch('singer');
|
||
|
}, true);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
function hideDetails() {
|
||
|
const songDetails = document.getElementById('song-details');
|
||
|
const overlay = document.getElementById('overlay');
|
||
|
if (songDetails) songDetails.style.display = 'none';
|
||
|
if (overlay) overlay.style.display = 'none';
|
||
|
}
|
||
|
|
||
|
function submitSearch(queryType) {
|
||
|
const singerName = document.getElementById('singer-name').value;
|
||
|
if (!singerName.trim()) {
|
||
|
alert('請輸入歌手名稱');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
fetch('/search', {
|
||
|
method: 'POST',
|
||
|
headers: {
|
||
|
'Content-Type': 'application/json;charset=UTF-8'
|
||
|
},
|
||
|
body: JSON.stringify({ query: singerName, type: queryType })
|
||
|
})
|
||
|
.then(response => response.json())
|
||
|
.then(data => {
|
||
|
const tableBody = document.querySelector('#results-table tbody');
|
||
|
tableBody.innerHTML = '';
|
||
|
|
||
|
if (!data || data.length === 0) {
|
||
|
alert('未找到相關歌曲');
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
data.forEach(song => {
|
||
|
const row = document.createElement('tr');
|
||
|
row.innerHTML = `
|
||
|
<td>${song.Song}</td>
|
||
|
<td>${song.ArtistA}</td>
|
||
|
<td>${song.Category}</td>
|
||
|
<td>${song.SongNumber}</td>
|
||
|
<td style="display:none;">${song.SongFilePathHost1}</td>
|
||
|
<td style="display:none;">${song.SongFilePathHost2}</td>
|
||
|
`;
|
||
|
row.addEventListener('click', function(e) {
|
||
|
e.preventDefault();
|
||
|
e.stopPropagation();
|
||
|
window.selectedSong = song;
|
||
|
|
||
|
document.getElementById('detail-song-name').textContent = song.Song;
|
||
|
document.getElementById('detail-song-number').textContent = song.SongNumber;
|
||
|
document.getElementById('detail-singer').textContent = song.ArtistA;
|
||
|
document.getElementById('detail-language').textContent = song.Category;
|
||
|
|
||
|
document.getElementById('song-details').style.display = 'block';
|
||
|
document.getElementById('overlay').style.display = 'block';
|
||
|
}, true);
|
||
|
|
||
|
tableBody.appendChild(row);
|
||
|
});
|
||
|
})
|
||
|
.catch(error => {
|
||
|
console.error('Error:', error);
|
||
|
alert('搜索失敗,請稍後重試');
|
||
|
});
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
</body>
|
||
|
</html>
|