Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch master (5c2c02)
by Sebastian
03:02
created

plugins/audioplayer/js/tx_dlf_audioplayer.js   A

Complexity

Total Complexity 9
Complexity/F 4.5

Size

Lines of Code 65
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
c 0
b 0
f 0
nc 1
dl 0
loc 65
rs 10
wmc 9
mnd 1
bc 3
fnc 2
bpm 1.5
cpm 4.5
noi 1
1
/**
2
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
3
 *
4
 * This file is part of the Kitodo and TYPO3 projects.
5
 *
6
 * @license GNU General Public License version 3 or later.
7
 * For the full copyright and license information, please read the
8
 * LICENSE.txt file that was distributed with this source code.
9
 */
10
11
/**
12
 * @param {Object} settings
13
 * @constructor
14
 */
15
var dlfAudioPlayer = function (settings) {
16
17
    var parentElId = settings.parentElId !== undefined ? settings.parentElId : 'tx-dlf-audio',
18
      swfPath = settings.swfPath !== undefined ? settings.swfPath : undefined,
19
      solutions = swfPath !== undefined ? 'html, flash' : 'html',
20
      audioOptions = settings.audio !== undefined ? settings.audio : undefined;
21
22
    if (audioOptions === undefined)
23
        throw new Error('Missing audio configurations.');
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
24
25
    var format = dlfAudioPlayer.JPLAYER_MIMETYPE_FORMAT_MAPPING[audioOptions.mimeType] !== undefined
26
            ? dlfAudioPlayer.JPLAYER_MIMETYPE_FORMAT_MAPPING[audioOptions.mimeType]
27
            : 'mp3';
28
    audioOptions[format] = audioOptions.url;
29
30
    //
31
    // Load params
32
    //
33
    var jPlayerOptions = {
34
        ready: function() {
35
          $(this).jPlayer('setMedia', audioOptions)
36
        },
37
        solution: solutions,
38
        supplied: format,
39
        cssSelectorAncestor: '#jp_container_1',
40
        useStateClassSkin: true,
41
        autoBlur: false,
42
        smoothPlayBar: true,
43
        keyEnabled: true,
44
        remainingDuration: false,
45
        toggleDuration: true
46
    };
47
48
    if (swfPath !== undefined) {
49
        jPlayerOptions['swfPath'] = swfPath;
50
    }
51
52
    //
53
    // Initialize the audio player
54
    //
55
56
    // player dom
57
    $('#' + parentElId).after('<div id="jp_container_1" class="jp-audio" role="application" aria-label="media player">' +
58
      '<div class="jp-type-single"><div class="jp-gui jp-interface"><div class="jp-volume-controls">' +
59
      '<button class="jp-mute" role="button" tabindex="0">mute</button><button class="jp-volume-max" role="button" tabindex="0">max volume</button>' +
60
      '<div class="jp-volume-bar"><div class="jp-volume-bar-value"></div></div></div><div class="jp-controls-holder">' +
61
      '<div class="jp-controls"><button class="jp-play" role="button" tabindex="0">play</button><button class="jp-stop" role="button" tabindex="0">stop</button>' +
62
      '</div><div class="jp-progress"><div class="jp-seek-bar"><div class="jp-play-bar"></div></div></div><div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div><span class="jp-duration-divider">/</span>' +
63
      '<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div><div class="jp-toggles"><button class="jp-repeat" role="button" tabindex="0">repeat</button>' +
64
      '</div></div></div><div class="jp-details"><div class="jp-title" aria-label="title">&nbsp;</div></div><div class="jp-no-solution">' +
65
      '<span>Update Required</span>To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.' +
66
      '</div></div></div>');
67
68
    // jplayer init
69
    $('#' + parentElId).jPlayer(jPlayerOptions);
70
};
71
72
/**
73
 * @type {{MP3: string}}
74
 */
75
dlfAudioPlayer.JPLAYER_MIMETYPE_FORMAT_MAPPING = {
76
    'audio/mpeg': 'mp3',
77
    'audio/mp4': 'm4a',
78
    'audio/wav': 'wav'
79
};
80