* Displays all of the waveforms necessary. * * @param {path} svg - The drawing of the waveform.
(svg)
| 315 | * @param {path} svg - The drawing of the waveform. |
| 316 | */ |
| 317 | function displayWaveForms(svg) { |
| 318 | let waveformElements = document.querySelectorAll(".amplitude-wave-form"); |
| 319 | |
| 320 | /* |
| 321 | Iterate over all of the waveform elements and |
| 322 | display the waveform. |
| 323 | */ |
| 324 | for (let i = 0; i < waveformElements.length; i++) { |
| 325 | /* |
| 326 | Get the playlist attribute of the waveform element. |
| 327 | */ |
| 328 | let playlist = waveformElements[i].getAttribute( |
| 329 | "data-amplitude-playlist" |
| 330 | ); |
| 331 | |
| 332 | /* |
| 333 | Get the song index attribute of the waveform element. |
| 334 | */ |
| 335 | let song = waveformElements[i].getAttribute("data-amplitude-song-index"); |
| 336 | |
| 337 | /* |
| 338 | If the playlist is null and the song is null it's a global element. |
| 339 | */ |
| 340 | if (playlist == null && song == null) { |
| 341 | displayGlobalWaveform(waveformElements[i], svg); |
| 342 | } |
| 343 | |
| 344 | /* |
| 345 | If the playlist is defined but the song is null it's a playlist element. |
| 346 | */ |
| 347 | if (playlist != null && song == null) { |
| 348 | displayPlaylistWaveform(waveformElements[i], svg, playlist); |
| 349 | } |
| 350 | |
| 351 | /* |
| 352 | If the playlist is not defined and the song is not null it's a song |
| 353 | element. |
| 354 | */ |
| 355 | if (playlist == null && song != null) { |
| 356 | displaySongWaveform(waveformElements[i], svg, song); |
| 357 | } |
| 358 | |
| 359 | /* |
| 360 | If the playlist and song are defined it's a song in the playlist element. |
| 361 | */ |
| 362 | if (playlist != null && song != null) { |
| 363 | displaySongInPlaylistWaveform(waveformElements[i], svg, playlist, song); |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * Displays a global wave form. |
no test coverage detected