Skip to content

Commit d1ee539

Browse files
abandone es6 syntax (#79)
1 parent 92f6023 commit d1ee539

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/pretty-checkbox.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function init(Survey) {
2-
const widget = {
2+
var widget = {
33
settings: {
44
supportedTypes: ["radiogroup", "checkbox", "boolean"],
55
radiogroup: {
@@ -32,7 +32,7 @@ function init(Survey) {
3232
},
3333
htmlTemplate: "<fieldset></fieldset>",
3434
isFit: function(question) {
35-
const isFitByType =
35+
var isFitByType =
3636
widget.settings.supportedTypes.indexOf(question.getType()) !== -1;
3737

3838
if (widget.activatedBy === "property") {
@@ -61,24 +61,24 @@ function init(Survey) {
6161
},
6262
isDefaultRender: false,
6363
afterRender: function(question, element) {
64-
const itemInputs = {};
65-
const questionType = question.getType();
66-
const options = this.settings[questionType];
67-
const checkboxType = questionType === "checkbox";
68-
const radiogroupType = questionType === "radiogroup";
69-
const booleanType = questionType === "boolean";
64+
var itemInputs = {};
65+
var questionType = question.getType();
66+
var options = this.settings[questionType];
67+
var checkboxType = questionType === "checkbox";
68+
var radiogroupType = questionType === "radiogroup";
69+
var booleanType = questionType === "boolean";
7070

7171
var inChangeHandler = false;
72-
const changeHandler = function(event) {
72+
var changeHandler = function(event) {
7373
inChangeHandler = true;
7474
try {
75-
const target = arguments[0].target;
76-
const targetValue = target.value;
77-
const targetChecked = target.checked;
75+
var target = arguments[0].target;
76+
var targetValue = target.value;
77+
var targetChecked = target.checked;
7878

7979
if (checkboxType) {
80-
const questionValue = question.value || [];
81-
const valueIndex = questionValue.indexOf(targetValue);
80+
var questionValue = question.value || [];
81+
var valueIndex = questionValue.indexOf(targetValue);
8282
if (targetChecked) {
8383
if (valueIndex === -1) {
8484
questionValue.push(targetValue);
@@ -100,14 +100,14 @@ function init(Survey) {
100100
}
101101
};
102102

103-
const itemWidth =
103+
var itemWidth =
104104
question.colCount > 0 ? 100 / question.colCount + "%" : "";
105105

106-
const choices = booleanType
106+
var choices = booleanType
107107
? [{ locText: question.locTitle, value: !!question.value }]
108108
: question.choices;
109109
choices.forEach(function(choiceItem, index) {
110-
const input = document.createElement("input");
110+
var input = document.createElement("input");
111111
input.type = options.inputType;
112112
input.name = question.name + (checkboxType ? "" + index : "");
113113
input.onchange = changeHandler;
@@ -117,20 +117,20 @@ function init(Survey) {
117117
input.indeterminate = question.defaultValue === "indeterminate";
118118
}
119119

120-
const controlRoot = document.createElement("div");
120+
var controlRoot = document.createElement("div");
121121
controlRoot.className = options.rootClass;
122122
controlRoot.appendChild(input);
123123

124124
options.states.forEach(function(state) {
125-
const stateRoot = document.createElement("div");
125+
var stateRoot = document.createElement("div");
126126
stateRoot.className = state.stateClass;
127127
if (!!state.iconClass) {
128-
const icon = document.createElement("i");
128+
var icon = document.createElement("i");
129129
icon.className = state.iconClass;
130130
stateRoot.appendChild(icon);
131131
}
132132

133-
const label = document.createElement("label");
133+
var label = document.createElement("label");
134134
if (choiceItem.locText.hasHtml) {
135135
label.innerHTML = choiceItem.locText.html;
136136
} else {
@@ -144,7 +144,7 @@ function init(Survey) {
144144
}
145145
});
146146

147-
const itemRoot = document.createElement("div");
147+
var itemRoot = document.createElement("div");
148148
itemRoot.className = "sv_cw_pretty_checkbox_" + questionType;
149149
itemRoot.style.display = "inline-block";
150150
itemRoot.style.width = itemWidth;
@@ -155,7 +155,7 @@ function init(Survey) {
155155
itemInputs[choiceItem.value] = input;
156156
});
157157

158-
const updateValueHandler = function(newValue) {
158+
var updateValueHandler = function(newValue) {
159159
if (!inChangeHandler) {
160160
var checkedItems = newValue || [];
161161
if (radiogroupType) {
@@ -171,7 +171,7 @@ function init(Survey) {
171171
});
172172
}
173173
};
174-
const readOnlyHandler = function() {
174+
var readOnlyHandler = function() {
175175
Object.values(itemInputs).forEach(function(inputItem) {
176176
if (question.isReadOnly) {
177177
inputItem.setAttribute("disabled", true);

0 commit comments

Comments
 (0)