Passed
Push — master ( 5322e3...8b6067 )
by Maxence
01:51
created

js/personal.elements.js   A

Complexity

Total Complexity 9
Complexity/F 1.13

Size

Lines of Code 52
Function Count 8

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
c 1
b 0
f 0
dl 0
loc 52
rs 10
cc 0
nc 1
mnd 1
bc 9
fnc 8
bpm 1.125
cpm 1.125
noi 4

3 Functions

Rating   Name   Duplication   Size   Complexity  
A pico_elements.initTweaks 0 9 1
A pico_elements.initElements 0 10 1
A pico_elements.initUI 0 14 1
1
/*
2
 * CMS Pico - Integration of Pico within your files to create websites.
3
 *
4
 * This file is licensed under the Affero General Public License version 3 or
5
 * later. See the COPYING file.
6
 *
7
 * @author Maxence Lange <[email protected]>
8
 * @copyright 2017
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
var pico_elements = {
27
28
	cms_pico_list_websites: null,
29
	cms_pico_new_name: null,
30
	cms_pico_new_url: null,
31
	cms_pico_new_website: null,
32
	cms_pico_new_path: null,
33
	cms_pico_new_folder: null,
34
	cms_pico_new_folder_result: '',
35
	cms_pico_new_submit: null,
36
37
38
	initElements: function () {
39
40
		pico_elements.cms_pico_list_websites = $('#cms_pico_list_websites');
41
		pico_elements.cms_pico_new_name = $('#cms_pico_new_name');
42
		pico_elements.cms_pico_new_website = $('#cms_pico_new_website');
43
		pico_elements.cms_pico_new_url = $('#cms_pico_new_url');
44
		pico_elements.cms_pico_new_path = $('#cms_pico_new_path');
45
		pico_elements.cms_pico_new_folder = $('#cms_pico_new_folder');
46
		pico_elements.cms_pico_new_submit = $('#cms_pico_new_submit');
47
	},
48
49
50
	initUI: function () {
51
		pico_elements.cms_pico_new_website.on('input propertychange paste focus', function () {
52
			pico_nav.updateNewWebsite($(this).val())
0 ignored issues
show
Bug introduced by
The variable pico_nav seems to be never declared. If this is a global, consider adding a /** global: pico_nav */ 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...
53
		});
54
55
		pico_elements.cms_pico_new_folder.on('click', function () {
56
			OC.dialogs.filepicker(t('cms_pico', 'test'), pico_result.pickFolderResult, false,
0 ignored issues
show
Bug introduced by
The variable OC seems to be never declared. If this is a global, consider adding a /** global: OC */ 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...
Bug introduced by
The variable pico_result seems to be never declared. If this is a global, consider adding a /** global: pico_result */ 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...
57
				"httpd/unix-directory", true);
58
		});
59
60
		pico_elements.cms_pico_new_submit.on('click', function () {
61
			pico_nav.createNewWebsite();
0 ignored issues
show
Bug introduced by
The variable pico_nav seems to be never declared. If this is a global, consider adding a /** global: pico_nav */ 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...
62
		});
63
	},
64
65
66
	initTweaks: function () {
67
		$.fn.emptyTable = function () {
68
			this.children('tr').each(function () {
69
				if ($(this).attr('class') !== 'header') {
70
					$(this).remove();
71
				}
72
			});
73
		};
74
	}
75
76
77
};