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.
Completed
Push — master ( a910b0...a0e75b )
by
unknown
04:10
created

src/Resources/public/js/image-preview.js   A

Complexity

Total Complexity 13
Complexity/F 1.18

Size

Lines of Code 49
Function Count 11

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 13
eloc 30
c 0
b 0
f 0
dl 0
loc 49
rs 10
mnd 2
bc 2
fnc 11
bpm 0.1818
cpm 1.1818
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
C image-preview.js ➔ displayUploadedImage 0 19 11
1
(function ( $ ) {
2
    'use strict';
3
4
    $.fn.extend({
5
        previewUploadedImage: function (root) {
6
            $(root + ' input[type="file"]').each(function() {
7
                $(this).change(function() {
8
                    displayUploadedImage(this);
9
                });
10
            });
11
12
            $(root + ' [data-form-collection="add"]').on('click', function() {
13
                var self = $(this);
14
15
                setTimeout(function() {
16
                    self.parent().find('.column:last-child input[type="file"]').on('change', function() {
17
                        displayUploadedImage(this);
18
                    });
19
                }, 500);
20
            });
21
        }
22
    });
23
24
    function displayUploadedImage(input) {
25
        if (input.files && input.files[0]) {
26
            var reader = new FileReader();
0 ignored issues
show
Bug introduced by
The variable FileReader seems to be never declared. If this is a global, consider adding a /** global: FileReader */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
27
28
            reader.onload = function (e) {
29
                var image = $(input).parent().siblings('.image');
30
31
                if (image.length > 0) {
32
                    image.attr('src', e.target.result);
33
                } else {
34
                    var img = $('<img class="ui small bordered image"/>');
35
                    img.attr('src', e.target.result);
36
                    $(input).parent().before(img);
37
                }
38
            };
39
40
            reader.readAsDataURL(input.files[0]);
41
        }
42
    }
43
})( jQuery );
44
45
(function($) {
46
    $(document).ready(function () {
47
        $(document).previewUploadedImage('#odiseo-image')
48
    });
49
})(jQuery);
50