Issues (119)

assets/js/laravel-h5p-library.js (7 issues)

1
/* 
2
 *
3
 * @Project        
4
 * @Copyright      Djoudi
5
 * @Created        2018-02-20
6
 * @Filename       laravel-h5p.js
7
 * @Description    
8
 *
9
 */
10
11
(function ($) {
12
   
13
    $(document).ready(function () {
14
15
   
16
        $(document).on("click", ".laravel-h5p-restricted", function (e) {
0 ignored issues
show
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
17
18
            var $this = $(this);
19
20
            $.ajax({
21
                url: "{{ route('laravel-h5p.library.restrict') }}",
22
                data: {id: $this.data('id'), selected: $this.is(':checked')},
23
                success: function (response) {
0 ignored issues
show
The parameter response is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
24
                    alert('Changed');
0 ignored issues
show
Debugging Code Best Practice introduced by
The alert UI element is often considered obtrusive and is generally only used as a temporary measure. Consider replacing it with another UI element.
Loading history...
25
                }
26
            });
27
28
        });
29
30
        $(document).on("click", ".laravel-h5p-destory", function (e) {
0 ignored issues
show
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
31
32
            var $this = $(this);
33
            if (confirm("Are you sure you want to delete this library?")) {
0 ignored issues
show
Debugging Code Best Practice introduced by
The confirm UI element is often considered obtrusive and is generally only used as a temporary measure. Consider replacing it with another UI element.
Loading history...
34
                $.ajax({
35
                    url: "{{ route('laravel-h5p.library.destory') }}",
36
                    data: {id: $this.data('id')},
37
                    success: function (response) {
38
                        //                        alert('Deleted');
39
                        if (response.msg) {
40
                            alert(response.msg);
0 ignored issues
show
Debugging Code Best Practice introduced by
The alert UI element is often considered obtrusive and is generally only used as a temporary measure. Consider replacing it with another UI element.
Loading history...
41
                        }
42
                    }
43
                });
44
45
            }
46
47
        });
48
49
    });
50
    
51
})(H5P.jQuery);
0 ignored issues
show
The variable H5P seems to be never declared. If this is a global, consider adding a /** global: H5P */ 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...