Advertisement
uncanniest

the-music-player page_template

Jan 26th, 2025
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. <div id="editor-tab-preview" class="card round secondary tab-container secondary round" style="height: max-content; max-height: initial; margin-bottom: 0px;">
  2. {{{ content }}}
  3. </div>
  4.  
  5. <div class="flex justify-space-between g-4 full" id="paste-info-box">
  6. <div class="flex g-4 flex-wrap">
  7. {{{ edit_button }}}
  8. {{{ config_button }}}
  9. </div>
  10.  
  11. <div class="flex flex-column g-2" style="color: var(--text-color-faded); min-width: max-content; align-items: flex-end;">
  12. <span class="flex g-4" id="paste-info-pub">
  13. <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cake-slice"><circle cx="9" cy="7" r="2"/><path d="M7.2 7.9 3 11v9c0 .6.4 1 1 1h16c.6 0 1-.4 1-1v-9c0-2-3-6-7-8l-3.6 2.6"><path d="M16 13H3"><path d="M16 17H3"></svg>
  14. Pub: <span class="date-time-to-localize">{{ pub_date }}</span>
  15. </path></path></path></span>
  16.  
  17. <span class="flex g-4" id="paste-info-edit">
  18. <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pencil"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"><path d="m15 5 4 4"></svg>
  19. Edit: <span class="date-time-to-localize">{{ edit_date }}</span>
  20. </path></path></span>
  21.  
  22. <span id="paste-info-owner">
  23. Owner: {{{ owner_button }}}
  24. </span>
  25.  
  26. <span id="paste-info-views">Views: {{ views }}</span>
  27. </div>
  28. </div>
  29. <script>
  30. window.addEventListener('load', function() {
  31. const initMusicPlayer = function() {
  32. let musicPixel = document.querySelector('#musicpixel');
  33. let audio = document.querySelector('#musicsrc');
  34. let playButton = document.querySelector('.playpause');
  35.  
  36. if (!musicPixel || !audio || !playButton) return;
  37.  
  38. musicPixel.addEventListener('click', function() {
  39. if (playButton.innerHTML.includes('fa-play')) {
  40. audio.play().catch(function(error) {
  41. console.log("Audio play failed:", error);
  42. });
  43. playButton.innerHTML = '<i class="fas fa-pause"></i>';
  44. } else {
  45. audio.pause();
  46. playButton.innerHTML = '<i class="fas fa-play"></i>';
  47. }
  48. });
  49. };
  50.  
  51. // Initialize player
  52. initMusicPlayer();
  53.  
  54. // Re-initialize if content is dynamically loaded
  55. if (typeof window.onContentUpdate === 'function') {
  56. window.onContentUpdate(initMusicPlayer);
  57. }
  58. });
  59. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement