Skip to content

Commit 85684aa

Browse files
prettier (2)
1 parent cc941bb commit 85684aa

File tree

12 files changed

+543
-529
lines changed

12 files changed

+543
-529
lines changed

src/ck-editor.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
function init(Survey) {
22
var widget = {
3-
name: 'editor',
4-
title: 'Editor',
5-
iconName: 'icon-editor',
3+
name: "editor",
4+
title: "Editor",
5+
iconName: "icon-editor",
66
widgetIsLoaded: function() {
7-
return typeof CKEDITOR != 'undefined'
7+
return typeof CKEDITOR != "undefined";
88
},
99
isFit: function(question) {
10-
return question.getType() === 'editor'
10+
return question.getType() === "editor";
1111
},
1212
htmlTemplate:
1313
"<textarea rows='10' cols='80' style: {width:'100%'}></textarea>",
1414
activatedByChanged: function(activatedBy) {
15-
Survey.JsonObject.metaData.addClass('editor', [], null, 'empty')
16-
Survey.JsonObject.metaData.addProperty('editor', {
17-
name: 'height',
18-
default: 300,
19-
})
15+
Survey.JsonObject.metaData.addClass("editor", [], null, "empty");
16+
Survey.JsonObject.metaData.addProperty("editor", {
17+
name: "height",
18+
default: 300
19+
});
2020
},
2121
afterRender: function(question, el) {
2222
CKEDITOR.editorConfig = function(config) {
23-
config.language = 'es'
24-
config.height = question.height
25-
config.toolbarCanCollapse = true
26-
}
27-
var editor = CKEDITOR.replace(el)
28-
var isValueChanging = false
23+
config.language = "es";
24+
config.height = question.height;
25+
config.toolbarCanCollapse = true;
26+
};
27+
var editor = CKEDITOR.replace(el);
28+
var isValueChanging = false;
2929
var updateValueHandler = function() {
30-
if (isValueChanging) return
31-
editor.setData(question.value)
32-
}
33-
editor.on('change', function() {
34-
isValueChanging = true
35-
question.value = editor.getData()
36-
isValueChanging = false
37-
})
38-
question.valueChangedCallback = updateValueHandler
39-
updateValueHandler()
30+
if (isValueChanging) return;
31+
editor.setData(question.value);
32+
};
33+
editor.on("change", function() {
34+
isValueChanging = true;
35+
question.value = editor.getData();
36+
isValueChanging = false;
37+
});
38+
question.valueChangedCallback = updateValueHandler;
39+
updateValueHandler();
4040
},
41-
willUnmount: function(question, el) {},
42-
}
41+
willUnmount: function(question, el) {}
42+
};
4343

44-
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, 'customtype')
44+
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, "customtype");
4545
}
4646

47-
if (typeof Survey !== 'undefined') {
48-
init(Survey)
47+
if (typeof Survey !== "undefined") {
48+
init(Survey);
4949
}
5050

51-
export default init
51+
export default init;

src/icheck.js

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
function init(Survey) {
22
var widget = {
3-
className: 'iradio_square-blue',
4-
name: 'icheck',
3+
className: "iradio_square-blue",
4+
name: "icheck",
55
widgetIsLoaded: function() {
6-
return typeof $ == 'function' && !!$.fn.iCheck
6+
return typeof $ == "function" && !!$.fn.iCheck;
77
},
88
isFit: function(question) {
9-
var t = question.getType()
10-
return t === 'radiogroup' || t === 'checkbox' || t === 'matrix'
9+
var t = question.getType();
10+
return t === "radiogroup" || t === "checkbox" || t === "matrix";
1111
},
1212
isDefaultRender: true,
1313
afterRender: function(question, el) {
14-
var rootWidget = this
15-
var $el = $(el)
16-
$el.find('input').data({ iCheck: undefined })
14+
var rootWidget = this;
15+
var $el = $(el);
16+
$el.find("input").data({ iCheck: undefined });
1717

18-
$el.find('input').iCheck({
18+
$el.find("input").iCheck({
1919
checkboxClass: rootWidget.className,
20-
radioClass: rootWidget.className,
21-
})
20+
radioClass: rootWidget.className
21+
});
2222
var select = function() {
23-
if (question.getType() != 'matrix') {
24-
$el.find('input[value=' + question.value + ']').iCheck('check')
23+
if (question.getType() != "matrix") {
24+
$el.find("input[value=" + question.value + "]").iCheck("check");
2525
} else {
2626
question.generatedVisibleRows.forEach(function(row, index, rows) {
2727
if (row.value) {
2828
$(el)
2929
.find(
30-
"input[name='" + row.fullName + "'][value=" + row.value + ']'
30+
"input[name='" + row.fullName + "'][value=" + row.value + "]"
3131
)
32-
.iCheck('check')
32+
.iCheck("check");
3333
}
34-
})
34+
});
3535
}
36-
}
37-
$el.find('input').on('ifChecked', function(event) {
38-
if (question.getType() != 'matrix') {
39-
question.value = event.target.value
36+
};
37+
$el.find("input").on("ifChecked", function(event) {
38+
if (question.getType() != "matrix") {
39+
question.value = event.target.value;
4040
} else {
4141
question.generatedVisibleRows.forEach(function(row, index, rows) {
4242
if (row.fullName === event.target.name) {
43-
row.value = event.target.value
43+
row.value = event.target.value;
4444
}
45-
})
45+
});
4646
}
47-
})
48-
question.valueChangedCallback = select
49-
select()
47+
});
48+
question.valueChangedCallback = select;
49+
select();
5050
},
5151
willUnmount: function(question, el) {
52-
var $el = $(el)
53-
$el.find('input').iCheck('destroy')
54-
},
55-
}
52+
var $el = $(el);
53+
$el.find("input").iCheck("destroy");
54+
}
55+
};
5656

57-
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, 'type')
57+
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, "type");
5858
}
5959

60-
if (typeof Survey !== 'undefined') {
61-
init(Survey)
60+
if (typeof Survey !== "undefined") {
61+
init(Survey);
6262
}
6363

64-
export default init
64+
export default init;

src/image-picker.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
function init(Survey) {
22
var widget = {
3-
name: 'imagepicker',
4-
title: 'Image picker',
5-
iconName: 'icon-imagepicker',
3+
name: "imagepicker",
4+
title: "Image picker",
5+
iconName: "icon-imagepicker",
66
widgetIsLoaded: function() {
7-
return typeof $ == 'function' && !!$.fn.imagepicker
7+
return typeof $ == "function" && !!$.fn.imagepicker;
88
},
99
isFit: function(question) {
10-
return question.getType() === 'imagepicker'
10+
return question.getType() === "imagepicker";
1111
},
1212
isDefaultRender: true,
1313
activatedByChanged: function(activatedBy) {
1414
Survey.JsonObject.metaData.addClass(
15-
'imageitemvalues',
16-
[{ name: 'imageLink' }],
15+
"imageitemvalues",
16+
[{ name: "imageLink" }],
1717
null,
18-
'itemvalue'
19-
)
18+
"itemvalue"
19+
);
2020
Survey.JsonObject.metaData.addClass(
21-
'imagepicker',
21+
"imagepicker",
2222
[
2323
{
24-
name: 'choices:imageitemvalues',
24+
name: "choices:imageitemvalues",
2525
onGetValue: function(obj) {
26-
return Survey.ItemValue.getData(obj.choices)
26+
return Survey.ItemValue.getData(obj.choices);
2727
},
2828
onSetValue: function(obj, value) {
29-
obj.choices = value
30-
},
29+
obj.choices = value;
30+
}
3131
},
32-
{ name: 'showLabel:boolean', default: false },
33-
{ name: 'hasOther', visible: false },
34-
{ name: 'otherText', visible: false },
35-
{ name: 'optionsCaption', visible: false },
36-
{ name: 'otherErrorText', visible: false },
37-
{ name: 'storeOthersAsComment', visible: false },
38-
{ name: 'renderAs', visible: false },
32+
{ name: "showLabel:boolean", default: false },
33+
{ name: "hasOther", visible: false },
34+
{ name: "otherText", visible: false },
35+
{ name: "optionsCaption", visible: false },
36+
{ name: "otherErrorText", visible: false },
37+
{ name: "storeOthersAsComment", visible: false },
38+
{ name: "renderAs", visible: false }
3939
],
4040
null,
41-
'dropdown'
42-
)
41+
"dropdown"
42+
);
4343
},
4444
afterRender: function(question, el) {
45-
var $el = $(el).is('select') ? $(el) : $(el).find('select')
46-
var options = $el.find('option')
47-
var choices = question.choices
45+
var $el = $(el).is("select") ? $(el) : $(el).find("select");
46+
var options = $el.find("option");
47+
var choices = question.choices;
4848

4949
for (var i = 1; i < options.length && i - 1 < choices.length; i++) {
50-
$(options[i]).data('imgSrc', choices[i - 1].imageLink)
51-
options[i].selected = question.value == options[i].value
50+
$(options[i]).data("imgSrc", choices[i - 1].imageLink);
51+
options[i].selected = question.value == options[i].value;
5252
}
5353
$el.imagepicker({
5454
hide_select: true,
5555
show_label: question.showLabel,
5656
selected: function(opts) {
57-
question.value = opts.picker.select[0].value
58-
},
59-
})
57+
question.value = opts.picker.select[0].value;
58+
}
59+
});
6060
},
6161
willUnmount: function(question, el) {
62-
var $el = $(el).find('select')
63-
$el.data('picker').destroy()
64-
},
65-
}
62+
var $el = $(el).find("select");
63+
$el.data("picker").destroy();
64+
}
65+
};
6666

67-
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, 'customtype')
67+
Survey.CustomWidgetCollection.Instance.addCustomWidget(widget, "customtype");
6868
}
6969

70-
if (typeof Survey !== 'undefined') {
71-
init(Survey)
70+
if (typeof Survey !== "undefined") {
71+
init(Survey);
7272
}
7373

74-
export default init
74+
export default init;

0 commit comments

Comments
 (0)