1 | /** |
||
2 | * Audio Player |
||
3 | * |
||
4 | * This file is licensed under the Affero General Public License version 3 or |
||
5 | * later. See the LICENSE.md file. |
||
6 | * |
||
7 | * @author Marcel Scherello <[email protected]> |
||
8 | * @author Sebastian Doell <[email protected]> |
||
9 | * @copyright 2016-2019 Marcel Scherello |
||
10 | * @copyright 2015 Sebastian Doell |
||
11 | */ |
||
12 | |||
13 | 'use strict'; |
||
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
14 | |||
15 | $(document).ready(function () { |
||
0 ignored issues
–
show
|
|||
16 | if ($('#header').hasClass('share-file')) { |
||
0 ignored issues
–
show
|
|||
17 | var mime_array = ['audio/mpeg', 'audio/mp4', 'audio/m4b', 'audio/ogg', 'audio/wav', 'audio/flac']; |
||
18 | var mimeType = $('#mimetype').val(); |
||
0 ignored issues
–
show
|
|||
19 | var sharingToken = $('#sharingToken'); |
||
0 ignored issues
–
show
|
|||
20 | |||
21 | var token = (sharingToken.val() !== undefined) ? sharingToken.val() : ''; |
||
22 | if (mime_array.indexOf(mimeType) !== -1) { |
||
23 | |||
24 | var imgFrame = $('#imgframe'); |
||
0 ignored issues
–
show
|
|||
25 | imgFrame.css({'max-width': '450px'}); |
||
26 | |||
27 | if (imgFrame.find('audio').length === 0) { |
||
28 | var downloadURL = $('#downloadURL').val(); |
||
0 ignored issues
–
show
|
|||
29 | var audioTag = '<audio tabindex="0" controls preload="none" style="width: 100%;"> <source src="' + downloadURL + '" type="' + mimeType + '"/> </audio>'; |
||
30 | imgFrame.append(audioTag); |
||
31 | } |
||
32 | |||
33 | imgFrame.after($('<div/>').attr('id', 'id3')); |
||
0 ignored issues
–
show
|
|||
34 | var ajaxurl = OC.generateUrl('apps/audioplayer/getpublicaudioinfo?token={token}', {'token': token}, {escape: false}); |
||
35 | |||
36 | $.ajax({ |
||
0 ignored issues
–
show
|
|||
37 | type: 'GET', |
||
38 | url: ajaxurl, |
||
39 | success: function (jsondata) { |
||
40 | if (jsondata.status === 'success') { |
||
41 | var $id3 = $('#id3'); |
||
0 ignored issues
–
show
|
|||
42 | if (jsondata.data.title !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Title') + ': ')).append($('<span/>').text(jsondata.data.title))); |
||
0 ignored issues
–
show
|
|||
43 | if (jsondata.data.subtitle !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Subtitle') + ': ')).append($('<span/>').text(jsondata.data.subtitle))); |
||
0 ignored issues
–
show
|
|||
44 | if (jsondata.data.artist !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Artist') + ': ')).append($('<span/>').text(jsondata.data.artist))); |
||
0 ignored issues
–
show
|
|||
45 | if (jsondata.data.albumartist !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Album Artist') + ': ')).append($('<span/>').text(jsondata.data.albumartist))); |
||
0 ignored issues
–
show
|
|||
46 | if (jsondata.data.composer !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Composer') + ': ')).append($('<span/>').text(jsondata.data.composer))); |
||
0 ignored issues
–
show
|
|||
47 | if (jsondata.data.album !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Album') + ': ')).append($('<span/>').text(jsondata.data.album))); |
||
0 ignored issues
–
show
|
|||
48 | if (jsondata.data.genre !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Genre') + ': ')).append($('<span/>').text(jsondata.data.genre))); |
||
0 ignored issues
–
show
|
|||
49 | if (jsondata.data.year !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Year') + ': ')).append($('<span/>').text(jsondata.data.year))); |
||
0 ignored issues
–
show
|
|||
50 | if (jsondata.data.number !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Disc') + '-' + t('audioplayer', 'Track') + ': ')).append($('<span/>').text(jsondata.data.disc + '-' + jsondata.data.number))); |
||
0 ignored issues
–
show
|
|||
51 | if (jsondata.data.length !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Length') + ': ')).append($('<span/>').text(jsondata.data.length))); |
||
0 ignored issues
–
show
|
|||
52 | if (jsondata.data.bitrate !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'Bitrate') + ': ')).append($('<span/>').text(jsondata.data.bitrate + ' kbps'))); |
||
0 ignored issues
–
show
|
|||
53 | if (jsondata.data.mimetype !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'MIME type') + ': ')).append($('<span/>').text(jsondata.data.mimetype))); |
||
0 ignored issues
–
show
|
|||
54 | if (jsondata.data.isrc !== '') $id3.append($('<div/>').append($('<b/>').text(t('audioplayer', 'ISRC') + ': ')).append($('<span/>').text(jsondata.data.isrc))); |
||
0 ignored issues
–
show
|
|||
55 | if (jsondata.data.copyright !== '') $id3.append($('<div/>').append($('<span/>').text(t('audioplayer', 'Copyright') + ' © ')).append($('<span/>').text(jsondata.data.copyright))); |
||
0 ignored issues
–
show
There were too many errors found in this file; checking aborted after 85%.
If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue. Further Reading:
Loading history...
|
|||
56 | $('.directDownload').css({'padding-top':'20px'}); |
||
57 | $('.publicpreview').css({'padding-top': '20px'}); |
||
58 | } |
||
59 | } |
||
60 | }); |
||
61 | } |
||
62 | } |
||
63 | }); |
||
64 |