settings.js
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
(function($){
FLBuilder.registerModuleHelper('button', {
rules: {
link: {
required: true
},
border_size: {
required: true,
number: true
},
bg_opacity: {
required: true,
number: true
},
font_size: {
required: true,
number: true
},
padding: {
required: true,
number: true
},
border_radius: {
required: true,
number: true
}
},
init: function()
{
$( 'input[name=bg_color]' ).on( 'change', this._bgColorChange );
this._bgColorChange();
$( 'select[name=click_action]' ).on( 'change', this._clickActionChange );
this._clickActionChange();
$( 'select[name=lightbox_content_type]' ).on( 'change', this._contentTypeChange );
this._contentTypeChange();
},
_bgColorChange: function()
{
var bgColor = $( 'input[name=bg_color]' ),
style = $( '#fl-builder-settings-section-style' );
if ( '' == bgColor.val() ) {
style.hide();
}
else {
style.show();
}
},
_clickActionChange: function()
{
var clickAction = $( 'select[name=click_action]' ).val(),
link = $( 'input[name=link]' );
if ( clickAction == 'link' ) {
link.rules('add', {
required: true
});
}
else {
link.rules('remove');
}
},
_contentTypeChange: function()
{
var contentType = $( 'select[name=lightbox_content_type]' ).val(),
fieldCode = $( '.fl-code-field' ),
activeEditor = fieldCode.find('.ace_editor'),
editor = ace.edit(activeEditor[0]);
/**
* Fix for initializing hidden Ace editor
*/
if (contentType == 'html') {
editor.resize();
editor.renderer.updateFull();
}
}
});
})(jQuery);