public/js/filemanager.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 2.5

Size

Lines of Code 9
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 7
mnd 3
bc 3
fnc 2
dl 0
loc 9
rs 10
bpm 1.5
cpm 2.5
noi 0
c 0
b 0
f 0
1
/**
2
 * Open file manager and return selected files.
3
 * Promise is never resolved if window is closed.
4
 *
5
 * @returns Promise<array> Array of selected files with properties:
6
 *      icon        string
7
 *      is_file     bool
8
 *      is_image    bool
9
 *      name        string
10
 *      thumb_url   string|null
11
 *      time        int
12
 *      url         string
13
 */
14
window.filemanager = function filemanager() {
15
    var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/filemanager';
16
    var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'FileManager';
17
    var features = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'width=900,height=600';
18
    return new Promise(function (resolve) {
19
        window.open(url, target, features);
20
        window.SetUrl = resolve;
21
    });
22
};
23