assets/scripts/imagesize.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 44
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 44
rs 10
c 0
b 0
f 0
cc 0
nc 1
mnd 0
bc 4
fnc 4
bpm 1
cpm 1
noi 0
1
var ImageSize = function(className) {
2
    
3
    /**
4
     * imageSize variable is created to represent ImageSize instance.
5
     */
6
    var imageSize = this;
7
8
    /**
9
     * element variable is created to represent master element of the ImageSize.
10
     */
11
    var element = $(className);
12
13
    /**
14
     * selectElement variable is created to represent select input of the PostType.
15
     */
16
    var selectElement = element.
17
18
    /**
19
     * Initialize actions when create a ImageSize instance.
20
     */
21
    this.init = function() {
22
        // Initialize Select2 for select input.
23
        imageSize.initializeSelect2();
24
    }
25
26
    /**
27
     * Initialize Select2 for select input.
28
     */
29
    this.initializeSelect2 = function() {
30
        selectElement.select2();
31
    }
32
33
    /**
34
     * Delete the ImageSize.
35
     */ 
36
    this.delete = function() {
37
        /* Remove the image size element. */
38
        element.remove();
39
    }
40
41
    imageSize.init();
42
}
43
44
module.exports = ImageSize;