scripts.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. Amplitude.init({
  2. "songs": [
  3. {
  4. "name": "Mazurka in A minor, Op. 17 No. 4",
  5. "artist": "Frédéric Chopin",
  6. "album": "",
  7. "url": "/audio/mazurka_am.mp3",
  8. "cover_art_url": "/img/chopin.png"
  9. },
  10. {
  11. "name": "Doctor Gradus as Parnuassum",
  12. "artist": "Claude Debussy",
  13. "album": "Children's Corner Suite, L 113",
  14. "url": "/audio/dr_gradus.m4a",
  15. "cover_art_url": "/img/gradus.png"
  16. },
  17. {
  18. "name": "Sonatina in C Major, Op. 55 No. 1",
  19. "artist": "Friedrich Kuhlau",
  20. "album": "",
  21. "url": "/audio/Kuhlau.mp3",
  22. "cover_art_url": "/img/kuhlau.png"
  23. },
  24. {
  25. "name": "China",
  26. "artist": "2010",
  27. "album": "Icon",
  28. "url": "/audio/icon/01_China.mp3",
  29. "cover_art_url": "/img/icons.jpg"
  30. },
  31. {
  32. "name": "Experiment in C Minor",
  33. "artist": "2010",
  34. "album": "Icon",
  35. "url": "/audio/icon/02_Experiment_in_Cm.mp3",
  36. "cover_art_url": "/img/icons.jpg"
  37. },
  38. {
  39. "name": "E Minor Diversion",
  40. "artist": "2010",
  41. "album": "Icon",
  42. "url": "/audio/icon/03_EmDiversion.mp3",
  43. "cover_art_url": "/img/icons.jpg"
  44. },
  45. {
  46. "name": "Poem",
  47. "artist": "2010",
  48. "album": "Icon",
  49. "url": "/audio/icon/06_Poem.mp3",
  50. "cover_art_url": "/img/icons.jpg"
  51. },
  52. {
  53. "name": "The Other Room",
  54. "artist": "2010",
  55. "album": "Icon",
  56. "url": "/audio/icon/07_The_Other_Room.mp3",
  57. "cover_art_url": "/img/icons.jpg"
  58. },
  59. {
  60. "name": "Smokin",
  61. "artist": "2010",
  62. "album": "Icon",
  63. "url": "/audio/icon/08_Smokin.mp3",
  64. "cover_art_url": "/img/icons.jpg"
  65. },
  66. {
  67. "name": "Poem #2",
  68. "artist": "2010",
  69. "album": "Icon",
  70. "url": "/audio/icon/09_poem3.mp3",
  71. "cover_art_url": "/img/icons.jpg"
  72. },
  73. {
  74. "name": "Poem #4",
  75. "artist": "2010",
  76. "album": "Icon",
  77. "url": "/audio/icon/06_poem4.mp3",
  78. "cover_art_url": "/img/icons.jpg"
  79. },
  80. {
  81. "name": "Prelude in G Minor",
  82. "artist": "2010",
  83. "album": "Icon",
  84. "url": "/audio/icon/11_Prelude_in_Gm.mp3",
  85. "cover_art_url": "/img/icons.jpg"
  86. },
  87. {
  88. "name": "Farout",
  89. "artist": "2010",
  90. "album": "Icon",
  91. "url": "/audio/icon/12_farout.mp3",
  92. "cover_art_url": "/img/icons.jpg"
  93. },
  94. {
  95. "name": "China #2",
  96. "artist": "2010",
  97. "album": "Icon",
  98. "url": "/audio/icon/15_china2.mp3",
  99. "cover_art_url": "/img/icons.jpg"
  100. },
  101. {
  102. "name": "Clementi Sample",
  103. "artist": "2010",
  104. "album": "Diversions",
  105. "url": "/audio/diversions/1_clementisample.mp3",
  106. "cover_art_url": "/img/diversions.jpg"
  107. },
  108. ],
  109. "callbacks": {
  110. 'play': function(){
  111. document.getElementById('album-art').style.visibility = 'hidden';
  112. document.getElementById('large-visualization').style.visibility = 'visible';
  113. },
  114. 'pause': function(){
  115. document.getElementById('album-art').style.visibility = 'visible';
  116. document.getElementById('large-visualization').style.visibility = 'hidden';
  117. }
  118. },
  119. waveforms: {
  120. sample_rate: 200
  121. }
  122. });
  123. let songElements = document.getElementsByClassName('song');
  124. for( var i = 0; i < songElements.length; i++ ){
  125. /*
  126. Ensure that on mouseover, CSS styles don't get messed up for active songs.
  127. */
  128. songElements[i].addEventListener('mouseover', function(){
  129. this.style.backgroundColor = '#494949';
  130. this.querySelectorAll('.song-meta-data .song-title')[0].style.color = '#FFFFFF';
  131. this.querySelectorAll('.song-meta-data .song-artist')[0].style.color = '#FFFFFF';
  132. if( !this.classList.contains('amplitude-active-song-container') ){
  133. this.querySelectorAll('.play-button-container')[0].style.display = 'block';
  134. }
  135. this.querySelectorAll('.song-duration')[0].style.color = '#FFFFFF';
  136. });
  137. /*
  138. Ensure that on mouseout, CSS styles don't get messed up for active songs.
  139. */
  140. songElements[i].addEventListener('mouseout', function(){
  141. this.style.backgroundColor = '#FFFFFF';
  142. this.querySelectorAll('.song-meta-data .song-title')[0].style.color = '#272726';
  143. this.querySelectorAll('.song-meta-data .song-artist')[0].style.color = '#607D8B';
  144. this.querySelectorAll('.play-button-container')[0].style.display = 'none';
  145. this.querySelectorAll('.song-duration')[0].style.color = '#607D8B';
  146. });
  147. /*
  148. Show and hide the play button container on the song when the song is clicked.
  149. */
  150. songElements[i].addEventListener('click', function(){
  151. this.querySelectorAll('.play-button-container')[0].style.display = 'none';
  152. });
  153. }
  154. const myModalEl = document.getElementById('Video');
  155. var video = document.getElementById("redemption");
  156. function stopVideo() {
  157. video.pause();
  158. video.currentTime = 0;
  159. }
  160. myModalEl.addEventListener('hidden.bs.modal', event => {
  161. stopVideo();
  162. })