Passed
Push — master ( a2212a...a2212a )
by Matthias
01:47
created

js/app.js   A

Complexity

Total Complexity 12
Complexity/F 2.4

Size

Lines of Code 78
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 12
eloc 33
mnd 7
bc 7
fnc 5
dl 0
loc 78
rs 10
bpm 1.4
cpm 2.4
noi 5
c 0
b 0
f 0
1
/**
2
 * @copyright Copyright (c) 2017 Matthias Held <[email protected]>
3
 *
4
 * @author Matthias Held <[email protected]>
5
 *
6
 * @license GNU AGPL version 3 or any later version
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License as
10
 * published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
/* global OC */
23
(function() {
24
25
    if (!OCA.RansomwareDetection) {
0 ignored issues
show
Bug introduced by
The variable OCA seems to be never declared. If this is a global, consider adding a /** global: OCA */ 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...
26
        /**
27
         * Namespace for the ransomware recovery app
28
         * @namespace OCA.RansomwareDetection
29
         */
30
        OCA.RansomwareDetection = {};
31
    }
32
33
    /**
34
     * @namespace OCA.RansomwareDetection.App
35
     */
36
    OCA.RansomwareDetection.App = {
37
        utils: null,
38
        /**
39
         * File list for the "Ransomware recovery" section
40
         *
41
         * @member {OCA.RansomwareDetection.FileList}
42
         */
43
        fileList: null,
44
        /**
45
         * Scan for the "Ransomware recovery" section
46
         *
47
         * @member {OCA.RansomwareDetection.Scan}
48
         */
49
        scan: null,
50
51
        /**
52
         * Initializes the ransomware recovery app
53
         */
54
        initialize: function() {
55
            if (typeof OCA.RansomwareDetection.Utils != 'undefined') {
0 ignored issues
show
Bug introduced by
The variable OCA seems to be never declared. If this is a global, consider adding a /** global: OCA */ 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...
56
                this.utils = new OCA.RansomwareDetection.Utils();
57
                window.Utils = this.utils;
58
            }
59
            if (typeof OCA.RansomwareDetection.FileList != 'undefined') {
60
                this.fileList = new OCA.RansomwareDetection.FileList(
61
                    $('#app-content-ransomware-detection-filelist'), {}
62
                );
63
                window.FileList = this.fileList;
64
            }
65
66
            if (typeof OCA.RansomwareDetection.Scan != 'undefined') {
67
                this.scan = new OCA.RansomwareDetection.Scan(
68
                    $('#app-content-ransomware-detection-scan'), {}
69
                );
70
                window.Scan = this.scan;
71
            }
72
73
            OC.Plugins.attach('OCA.RansomwareDetection.App', this);
74
        },
75
76
        /**
77
         * Destroy the app
78
         */
79
        destroy: function() {
80
            if (typeof OCA.RansomwareDetection.Utils != 'undefined') {
0 ignored issues
show
Bug introduced by
The variable OCA seems to be never declared. If this is a global, consider adding a /** global: OCA */ 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...
81
                this.utils.destroy();
82
                this.utils = null;
83
            }
84
            if (typeof OCA.RansomwareDetection.Scan != 'undefined') {
85
                this.fileList.destroy();
86
                this.fileList = null;
87
            }
88
            if (typeof OCA.RansomwareDetection.Scan != 'undefined') {
89
                this.scan.destroy();
90
                this.scan = null;
91
            }
92
        }
93
    }
94
})();
95
96
$(document).ready(function() {
97
    _.defer(function() {
0 ignored issues
show
Bug introduced by
The variable _ seems to be never declared. If this is a global, consider adding a /** global: _ */ 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...
98
        OCA.RansomwareDetection.App.initialize();
0 ignored issues
show
Bug introduced by
The variable OCA seems to be never declared. If this is a global, consider adding a /** global: OCA */ 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...
99
    });
100
});
101