Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
- <meta name="theme-color" content="#121212"> <!-- Makes Chrome address bar match background -->
- <title>Recognized Songs</title>
- <style>
- html, body {
- margin: 0;
- padding: 0;
- background-color: #121212;
- color: #ffffff;
- font-family: Arial, sans-serif;
- height: 100%;
- overflow-x: hidden;
- }
- h1 {
- text-align: center;
- margin-top: 20px;
- }
- .song {
- background-color: #1f1f1f;
- margin: 15px;
- padding: 15px;
- border-radius: 10px;
- text-align: center;
- }
- .song button {
- background-color: #1DB954;
- border: none;
- color: white;
- padding: 10px 20px;
- margin-top: 10px;
- border-radius: 5px;
- font-size: 16px;
- cursor: pointer;
- }
- .song button:hover {
- background-color: #1ed760;
- }
- .timestamp {
- font-size: 12px;
- color: #aaaaaa;
- margin-top: 5px;
- }
- </style>
- </head>
- <body>
- <h1>Recognized Songs</h1>
- <div id="song-list">
- <!-- Songs will be dynamically inserted here -->
- </div>
- <script>
- // Try to trigger Chrome to hide the address bar
- window.addEventListener('load', function() {
- setTimeout(() => {
- window.scrollTo(0, 1);
- }, 0);
- });
- // Fetch song history JSON
- fetch('song_history.json?nocache=' + new Date().getTime())
- .then(response => response.json())
- .then(data => {
- data.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
- const container = document.getElementById('song-list');
- container.innerHTML = "";
- data.forEach(song => {
- if (song.artist !== "Unknown Artist") {
- const div = document.createElement('div');
- div.className = 'song';
- div.innerHTML = `
- <div><strong>${song.title}</strong> - ${song.artist}</div>
- <div>${song.album}</div>
- <div class="timestamp">${song.timestamp}</div>
- <a href="${song.youtube_music_url}" target="_blank">
- <button>Open in YouTube Music</button>
- </a>
- `;
- container.appendChild(div);
- }
- });
- })
- .catch(error => {
- document.getElementById('song-list').innerHTML = "<p>Failed to load songs.</p>";
- console.error('Error fetching song history:', error);
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement