]> git.0d.be Git - panikweb.git/commitdiff
js: get waveform based on mp3 url if that's the first one
authorFrédéric Péters <fpeters@0d.be>
Fri, 27 Dec 2019 08:45:17 +0000 (09:45 +0100)
committerFrédéric Péters <fpeters@0d.be>
Fri, 27 Dec 2019 08:45:17 +0000 (09:45 +0100)
panikweb_templates/static/js/specifics.js

index f19e92146e08fcb6c78f6b65834a220ce9a1f35a..5e1e51f4b59d7a4c5b41d6a2d6a521a2d66b50c7 100644 (file)
@@ -469,7 +469,8 @@ $(function() {
                        var audio_src = $(audio).find('source')[0];
                        var sound_id = $(audio).data('sound-id');
                        var $waveform = $(audio).next();
-                       $.getJSON(audio_src.src.replace('.ogg', '.waveform-500.json'), function(data) {
+                       var waveform_url = audio_src.src.replace(/.mp3|.ogg/, '.waveform-500.json');
+                       $.getJSON(waveform_url, function(data) {
                                $waveform.empty();
                                $waveform.append('<i class="duration">' + $waveform.data('duration-string') + '</i>');
                                $.each(data, function(k, val) {