| 1 |
(function ($) { |
| 2 |
"use strict"; |
| 3 |
jQuery(document).ready(function ($) { |
| 4 |
jQuery(document).on('change keyup', '.gfield input, .gfield select, .gfield textarea', function (event) { |
| 5 |
gf_raw_input_change(event, this); |
| 6 |
}); |
| 7 |
$("body").on('change', ".container-repeater-field .gform-grid-col--size-auto", function (e) { |
| 8 |
var self = $(this); |
| 9 |
var value = $(this).val(); |
| 10 |
var input_ids = $(this).attr("name"); |
| 11 |
if (input_ids === undefined) { |
| 12 |
return; |
| 13 |
} |
| 14 |
input_ids = input_ids.split("_"); |
| 15 |
var input_id = input_ids[1]; |
| 16 |
var form_ids = self.closest("form").attr("id"); |
| 17 |
form_ids = form_ids.split("_"); |
| 18 |
var form_id = form_ids[1]; |
| 19 |
var field_ids = input_ids[1].split("."); |
| 20 |
if (field_ids[1] == 2) { |
| 21 |
return; |
| 22 |
} |
| 23 |
var field_id = field_ids[0]; |
| 24 |
const obj = { |
| 25 |
[input_id]: value, |
| 26 |
[field_id + ".2"]: "" |
| 27 |
} |
| 28 |
var $nextSelect = $(this).closest(".ginput_container").find("#input_" + form_id + "_" + field_id + "_2_container select") |
| 29 |
$.post(gformChainedSelectData.ajaxUrl, { |
| 30 |
action: 'gform_get_next_chained_select_choices', |
| 31 |
input_id: input_id, |
| 32 |
form_id: form_id, |
| 33 |
field_id: field_id, |
| 34 |
value: obj, |
| 35 |
nonce: gformChainedSelectData.nonce |
| 36 |
}, function (response) { |
| 37 |
if (!response) { |
| 38 |
return; |
| 39 |
} |
| 40 |
var choices = $.parseJSON(response), |
| 41 |
optionsMarkup = ''; |
| 42 |
$nextSelect.find('option').remove(); |
| 43 |
if (choices.length <= 0) { |
| 44 |
//self.resetSelects( $select, true ); |
| 45 |
} else { |
| 46 |
var hasSelectedChoice = false; |
| 47 |
$.each(choices, function (i, choice) { |
| 48 |
var selected = choice.isSelected ? 'selected="selected"' : ''; |
| 49 |
if (selected) { |
| 50 |
hasSelectedChoice = true; |
| 51 |
} |
| 52 |
optionsMarkup += '<option value="' + choice.value + '"' + selected + '>' + choice.text + '</option>'; |
| 53 |
}); |
| 54 |
$nextSelect.show().append(optionsMarkup); |
| 55 |
// the placeholder will be selected by default, rather than removing it and re-adding, just force the noOptions option to be selected |
| 56 |
if (choices[0].noOptions) { |
| 57 |
var $noOption = $nextSelect.find('option:last-child').clone(), |
| 58 |
$nextSelects = $nextSelect.parents('span').nextAll().find('select'); |
| 59 |
$nextSelects.append($noOption); |
| 60 |
$nextSelects.add($nextSelect) |
| 61 |
.addClass('gf_no_options') |
| 62 |
.find('option:last-child').prop('selected', true); |
| 63 |
//self.toggleCompleted( true ); |
| 64 |
} else { |
| 65 |
$nextSelect |
| 66 |
.removeClass('gf_no_options') |
| 67 |
//.prop( 'disabled', false ).show(); |
| 68 |
.toggleSelect(false, self); |
| 69 |
if (hasSelectedChoice) { |
| 70 |
$nextSelect.change(); |
| 71 |
} |
| 72 |
} |
| 73 |
} |
| 74 |
//self.resizeSelects(); |
| 75 |
}); |
| 76 |
}) |
| 77 |
gform.addFilter('gform_is_value_match', function (isMatch, formId, rule) { |
| 78 |
var check_repeater = rule['fieldId'].toString().split("-"); |
| 79 |
if (check_repeater.length < 2) { |
| 80 |
return isMatch; |
| 81 |
} else { |
| 82 |
var $ = jQuery, |
| 83 |
inputId = rule['fieldId'], |
| 84 |
baseInputId = check_repeater[0], |
| 85 |
randId = check_repeater[1], |
| 86 |
baseFieldId = parseInt(baseInputId, 10), |
| 87 |
inputIndex = gformExtractInputIndex(baseInputId), |
| 88 |
isInputSpecific = inputIndex !== false, |
| 89 |
$inputs; |
| 90 |
if (isInputSpecific) { |
| 91 |
$inputs = $('#input_{0}_{1}_{2}-{3}, #choice_{0}_{1}_{2}-{3}'.gformFormat(formId, baseFieldId, inputIndex, randId)); |
| 92 |
} else { |
| 93 |
$inputs = $('input[id="input_{0}_{1}-{2}"], input[id^="input_{0}_{1}_"][id$="-{2}"], input[id^="choice_{0}_{1}_"][id$="-{2}"], select#input_{0}_{1}-{2}, textarea#input_{0}_{1}-{2}'.gformFormat(formId, baseFieldId, randId)); |
| 94 |
} |
| 95 |
var isCheckable = $.inArray($inputs.attr('type'), ['checkbox', 'radio']) !== -1; |
| 96 |
var isMatch = isCheckable ? gf_is_match_checkable($inputs, rule, formId, inputId) : gf_is_match_default($inputs.eq(0), rule, formId, inputId); |
| 97 |
return isMatch; |
| 98 |
} |
| 99 |
}); |
| 100 |
gform.addFilter('gform_field_meta_raw_input_change', function (form, input, event) { |
| 101 |
var htmlId = input.attr('id'); |
| 102 |
var fieldId = yeeaddons_gf_get_input_id_by_html_id(htmlId); |
| 103 |
var formId = gf_get_form_id_by_html_id(htmlId); |
| 104 |
if (formId !== undefined) { |
| 105 |
var check_ids = htmlId.split("-"); |
| 106 |
if (check_ids.length > 1) { |
| 107 |
form = { fieldId: fieldId, formId: formId }; |
| 108 |
} |
| 109 |
} |
| 110 |
return form; |
| 111 |
}); |
| 112 |
function yeeaddons_gf_get_input_id_by_html_id(htmlId) { |
| 113 |
var ids = htmlId ? htmlId.split('_') : []; |
| 114 |
if (ids.length >= 3) { |
| 115 |
var type = ids[0]; |
| 116 |
if (type === 'choice') { |
| 117 |
var fieldId = ids[2]; |
| 118 |
var randSuffix = ''; |
| 119 |
var lastPart = ids[ids.length - 1]; |
| 120 |
if (lastPart && lastPart.indexOf('-') !== -1) { |
| 121 |
var parts = lastPart.split('-'); |
| 122 |
randSuffix = '-' + parts[1]; |
| 123 |
} |
| 124 |
return fieldId + randSuffix; |
| 125 |
} else if (type === 'input') { |
| 126 |
if (ids.length === 3) { |
| 127 |
return ids[2]; |
| 128 |
} else if (ids.length >= 4) { |
| 129 |
var fieldId = ids[2]; |
| 130 |
var indexPart = ids[3]; |
| 131 |
return fieldId + '.' + indexPart; |
| 132 |
} |
| 133 |
} |
| 134 |
} |
| 135 |
return htmlId; |
| 136 |
} |
| 137 |
gform.addAction('gform_input_change', function (elem, formId, fieldId) { |
| 138 |
if (!window.gf_form_conditional_logic) { |
| 139 |
return; |
| 140 |
} |
| 141 |
var dependentFieldIds = rgars(gf_form_conditional_logic, [formId, 'fields', (fieldId)].join('/')); |
| 142 |
if (dependentFieldIds) { |
| 143 |
gf_apply_rules(formId, dependentFieldIds); |
| 144 |
} |
| 145 |
}, 10); |
| 146 |
get_repeater_data_name(); |
| 147 |
var names_upload = []; |
| 148 |
jQuery(document).on("gform_page_loaded", function (e, form_id) { |
| 149 |
//jQuery(".gform-datepicker").datepicker('destroy'); |
| 150 |
get_repeater_data_name(); |
| 151 |
}); |
| 152 |
jQuery(document).on('gform_post_render', function (event, form_id, current_page) { |
| 153 |
//jQuery(".gform-datepicker").datepicker('destroy'); |
| 154 |
get_repeater_data_name(); |
| 155 |
}); |
| 156 |
gform.addFilter('gform_file_upload_markup', function (html, file, up, strings, imagesUrl, response) { |
| 157 |
var formId = up.settings.multipart_params.form_id; |
| 158 |
var fieldId = up.settings.multipart_params.field_id; |
| 159 |
var container = $('#' + file.id).closest(".container-repeater-field"); |
| 160 |
var id_rand = container.data("id"); |
| 161 |
var nameAttr = 'gform_multifile_upload_' + formId + '_' + fieldId + '__' + id_rand; |
| 162 |
var repeater = container.find('input[name="' + nameAttr + '"]'); |
| 163 |
if (repeater.length === 0) { |
| 164 |
repeater = container.find(".gform_multifile_upload"); |
| 165 |
} |
| 166 |
var val_repeater = repeater.val(); |
| 167 |
var link = response.data.uploaded_filename; |
| 168 |
if (val_repeater == "") { |
| 169 |
repeater.val(link) |
| 170 |
} else { |
| 171 |
repeater.val(val_repeater + ", " + link); |
| 172 |
} |
| 173 |
return html.replace("onclick", "data-onclick");; |
| 174 |
}); |
| 175 |
var repeater_fields_htmls = {}; |
| 176 |
//condition out repeater out |
| 177 |
gform.addAction('gform_post_conditional_logic_field_action1', function (formId, action, targetId, defaultValues, isInit) { |
| 178 |
if (targetId != "") { |
| 179 |
var dat_select = targetId.replace("#", ''); |
| 180 |
$(".gf-field-repeater-data-html").each(function () { |
| 181 |
var html_data = $(this).val(); |
| 182 |
html_data = $(html_data); |
| 183 |
if (action == "hide") { |
| 184 |
$('[data-js-reload="' + dat_select + '"]', html_data).css("display", "none"); |
| 185 |
} else { |
| 186 |
$('[data-js-reload="' + dat_select + '"]', html_data).css("display", "block"); |
| 187 |
} |
| 188 |
$(this).val("<div class='container-repeater-field'>" + html_data.html() + '</div>'); |
| 189 |
}) |
| 190 |
if (action == "hide") { |
| 191 |
$('[data-js-reload="' + dat_select + '"]').css("display", "none"); |
| 192 |
} else { |
| 193 |
$('[data-js-reload="' + dat_select + '"]').css("display", "block"); |
| 194 |
} |
| 195 |
} |
| 196 |
}); |
| 197 |
$("body").on("click", ".gform_delete_file", function (e) { |
| 198 |
e.preventDefault(); |
| 199 |
var str = $(this).data("onclick"); |
| 200 |
const regex = /\((.*?)\)/gm; |
| 201 |
var m = ""; |
| 202 |
var a = ""; |
| 203 |
while ((m = regex.exec(str)) !== null) { |
| 204 |
// This is necessary to avoid infinite loops with zero-width matches |
| 205 |
if (m.index === regex.lastIndex) { |
| 206 |
regex.lastIndex++; |
| 207 |
} |
| 208 |
a = m[1].split(',');; |
| 209 |
} |
| 210 |
gformDeleteUploadedFileRepeater(a[0], a[1], $(this)); |
| 211 |
return; |
| 212 |
}) |
| 213 |
function gformDeleteUploadedFileRepeater(formId, fieldId, deleteButton) { |
| 214 |
if (deleteButton.closest(".repeater-field-warp-item-data").length > 0) { |
| 215 |
var rand_id = deleteButton.closest(".container-repeater-field").data("id"); |
| 216 |
var fileIndex = jQuery(deleteButton).parent().index(); |
| 217 |
var parent = deleteButton.closest(".container-repeater-field").find("#field_" + formId + "_" + fieldId + "-" + rand_id); |
| 218 |
if (parent.length === 0) { |
| 219 |
parent = jQuery("#field_" + formId + "_" + fieldId); |
| 220 |
} |
| 221 |
parent.find('input[type="file"],.validation_message,#extensions_message_' + formId + '_' + fieldId).removeClass("gform_hidden"); |
| 222 |
parent.find(".ginput_post_image_file").show(); |
| 223 |
//parent.find("input[type=\"text\"]").val(''); |
| 224 |
var filesJson = jQuery('#gform_uploaded_files_' + formId).val(); |
| 225 |
if (filesJson) { |
| 226 |
var files = jQuery.secureEvalJSON(filesJson); |
| 227 |
if (files) { |
| 228 |
var inputName = "input_" + fieldId; |
| 229 |
var full_name = deleteButton.closest(".container-repeater-field").find('input[name="gform_multifile_upload_' + formId + '_' + fieldId + '__' + rand_id + '"]').val(); |
| 230 |
if (full_name == "") { |
| 231 |
full_name = []; |
| 232 |
} else { |
| 233 |
full_name = full_name.split(","); |
| 234 |
} |
| 235 |
var $multfile = parent.find("#gform_multifile_upload_" + formId + "_" + fieldId + "__" + rand_id); |
| 236 |
var remove_name = deleteButton.closest(".ginput_preview").find(".gfield_fileupload_filename").html(); |
| 237 |
var index1 = full_name.indexOf(remove_name); |
| 238 |
if (index1 !== -1) { |
| 239 |
full_name.splice(index1, 1); |
| 240 |
} |
| 241 |
deleteButton.closest(".container-repeater-field").find('input[name="gform_multifile_upload_' + formId + '_' + fieldId + '__' + rand_id + '"]').val(full_name.join(",")); |
| 242 |
deleteButton.closest(".ginput_preview").remove(); |
| 243 |
if ($multfile.length > 0) { |
| 244 |
files[inputName].splice(fileIndex, 1); |
| 245 |
var settings = $multfile.data('settings'); |
| 246 |
var max = settings.gf_vars.max_files; |
| 247 |
jQuery("#" + settings.gf_vars.message_id + "__" + rand_id).html(''); |
| 248 |
if (files[inputName].length < max) |
| 249 |
gfMultiFileUploader.toggleDisabled(settings, false); |
| 250 |
} else { |
| 251 |
files[inputName] = null; |
| 252 |
} |
| 253 |
jQuery('#gform_uploaded_files_' + formId).val(jQuery.toJSON(files)); |
| 254 |
} |
| 255 |
} |
| 256 |
} else { |
| 257 |
var parent = jQuery("#field_" + formId + "_" + fieldId); |
| 258 |
var fileIndex = jQuery(deleteButton).parent().index(); |
| 259 |
deleteButton.closest(".ginput_preview").remove(); |
| 260 |
//displaying single file upload field |
| 261 |
parent.find('input[type="file"],.validation_message,#extensions_message_' + formId + '_' + fieldId).removeClass("gform_hidden"); |
| 262 |
//displaying post image label |
| 263 |
parent.find(".ginput_post_image_file").show(); |
| 264 |
//clearing post image meta fields |
| 265 |
parent.find("input[type=\"text\"]").val(''); |
| 266 |
//removing file from uploaded meta |
| 267 |
var filesJson = jQuery('#gform_uploaded_files_' + formId).val(); |
| 268 |
if (filesJson) { |
| 269 |
var files = jQuery.secureEvalJSON(filesJson); |
| 270 |
if (files) { |
| 271 |
var inputName = "input_" + fieldId; |
| 272 |
var $multfile = parent.find("#gform_multifile_upload_" + formId + "_" + fieldId); |
| 273 |
if ($multfile.length > 0) { |
| 274 |
files[inputName].splice(fileIndex, 1); |
| 275 |
var settings = $multfile.data('settings'); |
| 276 |
var max = settings.gf_vars.max_files; |
| 277 |
jQuery("#" + settings.gf_vars.message_id).html(''); |
| 278 |
if (files[inputName].length < max) |
| 279 |
gfMultiFileUploader.toggleDisabled(settings, false); |
| 280 |
} else { |
| 281 |
files[inputName] = null; |
| 282 |
} |
| 283 |
jQuery('#gform_uploaded_files_' + formId).val(jQuery.toJSON(files)); |
| 284 |
} |
| 285 |
} |
| 286 |
} |
| 287 |
} |
| 288 |
var input_ids = []; |
| 289 |
function change_name_and_ids(item, field_end = null, key = null) { |
| 290 |
if (key == null) { |
| 291 |
var id_rand = Math.floor(Math.random() * 10000); |
| 292 |
} else { |
| 293 |
var id_rand = key; |
| 294 |
} |
| 295 |
var datas = JSON.parse(field_end.find(".gf-field-repeater-data").val()); |
| 296 |
var datas_ids = datas.id; |
| 297 |
datas_ids.push(id_rand); |
| 298 |
datas.id = datas_ids; |
| 299 |
field_end.find(".gf-field-repeater-data").val(JSON.stringify(datas)); |
| 300 |
item = $(item); |
| 301 |
item.attr("data-id", id_rand); |
| 302 |
$(".gfield_visibility_visible", item).each(function () { |
| 303 |
var id = $(this).attr("id"); |
| 304 |
$(this).attr("id", id + "-" + id_rand); |
| 305 |
$(this).attr("data-js-reload", id + "-" + id_rand); |
| 306 |
}) |
| 307 |
$(".gform_fileupload_multifile", item).each(function () { |
| 308 |
var id = $(this).attr("id"); |
| 309 |
var container_item = $(this).closest(".gfield gfield--type-fileupload"); |
| 310 |
var settings = $(this).attr("data-settings"); |
| 311 |
settings = jQuery.parseJSON(settings); |
| 312 |
$.each(settings, function (index, value) { |
| 313 |
switch (index) { |
| 314 |
case "browse_button": |
| 315 |
case "container": |
| 316 |
case "drop_element": |
| 317 |
case "filelist": |
| 318 |
settings[index] = value + "__" + id_rand; |
| 319 |
$("#" + value, item).attr("id", value + "__" + id_rand); |
| 320 |
break; |
| 321 |
case "multipart_params": |
| 322 |
//settings["multipart_params"]["field_id"] = value.field_id + "__"+id_rand; |
| 323 |
break; |
| 324 |
} |
| 325 |
}); |
| 326 |
item.append('<input type="hidden" name="' + id + '" class="gform_multifile_upload" />'); |
| 327 |
$(this).attr("id", id + "__" + id_rand); |
| 328 |
$(this).attr("data-settings", JSON.stringify(settings)); |
| 329 |
names_upload.push(id + "__" + id_rand); |
| 330 |
}) |
| 331 |
$("input", item).each(function () { |
| 332 |
var name = $(this).attr("name"); |
| 333 |
if (typeof name !== 'string' || name == "MAX_FILE_SIZE") { |
| 334 |
return; |
| 335 |
} |
| 336 |
var type = $(this).attr("type"); |
| 337 |
var id = $(this).attr("id"); |
| 338 |
input_ids.push(id); |
| 339 |
if (name != "" && name.endsWith('[]')) { |
| 340 |
name = name.replace(/\[\]$/, ''); |
| 341 |
$(this).attr("name", name + "__" + id_rand + "[]"); |
| 342 |
} else { |
| 343 |
$(this).attr("name", name + "__" + id_rand); |
| 344 |
} |
| 345 |
$(this).attr("id", id + "-" + id_rand); |
| 346 |
var value_check = localStorage.getItem(id + "-" + id_rand); |
| 347 |
if (type == "checkbox") { |
| 348 |
$(this).closest("div").find("label").attr("for", id + "-" + id_rand); |
| 349 |
if (value_check != null) { |
| 350 |
$(this).attr("checked", "checked"); |
| 351 |
} |
| 352 |
} else if (type == "file") { |
| 353 |
$(this).attr("id", id + "-" + id_rand); |
| 354 |
} else if (type == "radio") { |
| 355 |
$(this).attr("id", id + "-" + id_rand); |
| 356 |
$(this).closest("div, li").find("label").attr("for", id + "-" + id_rand); |
| 357 |
var value_check = localStorage.getItem(name + "__" + id_rand); |
| 358 |
if (value_check != null) { |
| 359 |
var old_check = $(this).val(); |
| 360 |
if (old_check == value_check) { |
| 361 |
$(this).attr("checked", true); |
| 362 |
} |
| 363 |
} |
| 364 |
} |
| 365 |
else { |
| 366 |
// ensure the field label's "for" attribute corresponds with the field's ID |
| 367 |
$(this).closest("div").parent().find("label").attr("for", id + "-" + id_rand); |
| 368 |
if (value_check != null) { |
| 369 |
$(this).val(value_check); |
| 370 |
} |
| 371 |
} |
| 372 |
}) |
| 373 |
$("textarea", item).each(function () { |
| 374 |
var name = $(this).attr("name"); |
| 375 |
var id = $(this).attr("id"); |
| 376 |
$(this).attr("name", name + "__" + id_rand); |
| 377 |
$(this).attr("id", id + "-" + id_rand); |
| 378 |
// ensure the field label's "for" attribute corresponds with the field's ID |
| 379 |
$(this).closest("div").parent().find("label").attr("for", id + "-" + id_rand); |
| 380 |
var value_check = localStorage.getItem(id + "-" + id_rand); |
| 381 |
if (value_check != null) { |
| 382 |
$(this).val(value_check); |
| 383 |
} |
| 384 |
}) |
| 385 |
$("select", item).each(function () { |
| 386 |
var name = $(this).attr("name"); |
| 387 |
var id = $(this).attr("id"); |
| 388 |
if (name.includes("[")) { |
| 389 |
name = name.replace(/\[\]/g, ''); |
| 390 |
$(this).attr("name", name + "__" + id_rand + "[]"); |
| 391 |
} else { |
| 392 |
$(this).attr("name", name + "__" + id_rand); |
| 393 |
} |
| 394 |
$(this).attr("id", id + "-" + id_rand); |
| 395 |
// ensure the field label's "for" attribute corresponds with the field's ID |
| 396 |
$(this).closest("div").parent().find("label").attr("for", id + "-" + id_rand); |
| 397 |
var value_check = localStorage.getItem(id + "-" + id_rand); |
| 398 |
if (value_check != null) { |
| 399 |
$(this).val(value_check); |
| 400 |
} |
| 401 |
}) |
| 402 |
return item; |
| 403 |
} |
| 404 |
function add_repeater_data(button, key = null) { |
| 405 |
var start_field; |
| 406 |
if (key == null) { |
| 407 |
var key = Math.floor(Math.random() * 10000); |
| 408 |
} |
| 409 |
var item = $('<div class="repeater-field-item"><div class="repeater-field-header"></div><div class="repeater-field-content"></div></div>'); |
| 410 |
button.prevAll().each(function (index) { |
| 411 |
var item = $(this).clone(); |
| 412 |
if (item.hasClass("gfield--type-repeater_start")) { |
| 413 |
start_field = $(this); |
| 414 |
return false; |
| 415 |
} |
| 416 |
}) |
| 417 |
var html_field = get_repeater_data(button, key); |
| 418 |
var header = get_repeater_data_header(start_field); |
| 419 |
item.find(".repeater-field-header").append(header); |
| 420 |
item.find(".repeater-field-content").append(html_field); |
| 421 |
button.find(".repeater-field-warp-item").append(item); |
| 422 |
update_repeater_count_header(); |
| 423 |
$("input").trigger("done_load_repeater"); |
| 424 |
var form_ids = button.attr("id").split("_"); |
| 425 |
if (yeeaddons_gf_repeater_data.pro == "ok") { |
| 426 |
var form_id = form_ids[1]; |
| 427 |
if (window["gf_form_conditional_logic"] !== undefined) { |
| 428 |
if (typeof window["gf_form_conditional_logic"][form_id] !== "undefined") { |
| 429 |
var dependents = window["gf_form_conditional_logic"][form_id].dependents; |
| 430 |
var dependents_new = dependents; |
| 431 |
var dependents_new_id = []; |
| 432 |
$.each(dependents, function (key_1, value) { |
| 433 |
var datas_logic = []; |
| 434 |
$.each(value, function (key_2, value_2) { |
| 435 |
datas_logic.push(value_2 + "-" + key); |
| 436 |
}) |
| 437 |
if (key_1.search("-") < 0) { |
| 438 |
dependents_new[key_1 + "-" + key] = datas_logic; |
| 439 |
dependents_new_id.push(key_1 + "-" + key); |
| 440 |
} else { |
| 441 |
dependents_new_id.push(key_1); |
| 442 |
} |
| 443 |
}); |
| 444 |
var fields = window["gf_form_conditional_logic"][form_id].fields; |
| 445 |
var fields_new = fields; |
| 446 |
$.each(fields, function (key_1, value) { |
| 447 |
var datas_logic = []; |
| 448 |
$.each(value, function (key_2, value_2) { |
| 449 |
datas_logic.push(value_2 + "-" + key); |
| 450 |
}) |
| 451 |
if (key_1.search("-") < 0) { |
| 452 |
fields_new[key_1 + "-" + key] = datas_logic; |
| 453 |
} |
| 454 |
}); |
| 455 |
var logic = window["gf_form_conditional_logic"][form_id].logic; |
| 456 |
//console.log(window["gf_form_conditional_logic"][form_id]); |
| 457 |
var logic_new = logic; |
| 458 |
$.each(logic, function (key_1, value) { |
| 459 |
if (key_1.search("-") < 0) { |
| 460 |
// use old and add new repeater |
| 461 |
logic_new[key_1 + "-" + key] = yeeaddons_change_id_logic(value, key); |
| 462 |
} else { |
| 463 |
//da them |
| 464 |
} |
| 465 |
}); |
| 466 |
var animation = window["gf_form_conditional_logic"][form_id].animation; |
| 467 |
var defaults = window["gf_form_conditional_logic"][form_id].defaults; |
| 468 |
window["gf_form_conditional_logic"][form_id] = { animation: animation, defaults: defaults, dependents: dependents_new, fields: fields_new, logic: logic_new, "ok": "ok" }; |
| 469 |
gf_apply_rules(form_id, dependents_new_id, true); |
| 470 |
} |
| 471 |
} |
| 472 |
} |
| 473 |
//end logic |
| 474 |
|
| 475 |
$.each(names_upload, function (key_1, value) { |
| 476 |
if ($("#" + value).length > 0) { |
| 477 |
gfMultiFileUploader.setup("#" + value); |
| 478 |
} |
| 479 |
}); |
| 480 |
names_upload = []; |
| 481 |
var input_mask = yeeaddons_gf_repeater_data.input_mask; |
| 482 |
$.each(input_ids, function (key_1, value_1) { |
| 483 |
if (value_1 in input_mask) { |
| 484 |
$('#' + value_1 + "-" + key).mask(input_mask[value_1]).bind('keypress', function (e) { if (e.which == 13) { jQuery(this).blur(); } }) |
| 485 |
} |
| 486 |
}); |
| 487 |
conditional_logic_custom(key); |
| 488 |
input_ids = []; |
| 489 |
$('.gform-datepicker').each(function () { |
| 490 |
var $element = $(this); |
| 491 |
initSingleDatepicker($element); |
| 492 |
$element.addClass('initialized'); |
| 493 |
}); |
| 494 |
} |
| 495 |
function yeeaddons_change_id_logic(value, key) { |
| 496 |
var field_rules_inner = []; |
| 497 |
if (value && value.field && Array.isArray(value.field.rules)) { // added this line to fix js issue in add more to autofill multiple data |
| 498 |
$.each(value.field.rules, function (key_2, value_2) { |
| 499 |
if (value_2.fieldId.search("-") < 0) { |
| 500 |
var field_id_1 = value_2.fieldId + "-" + key; |
| 501 |
} |
| 502 |
field_rules_inner.push({ fieldId: field_id_1, operator: value_2.operator, value: value_2.value }); |
| 503 |
}) |
| 504 |
var rules = field_rules_inner; |
| 505 |
var field = { actionType: value.field.actionType, enabled: value.field.enabled, logicType: value.field.logicType, rules: rules }; |
| 506 |
return { field: field, nextButton: value.nextButton, section: value.section }; |
| 507 |
} else { |
| 508 |
return value; |
| 509 |
} |
| 510 |
|
| 511 |
} |
| 512 |
function conditional_logic_custom(rand) { |
| 513 |
return; |
| 514 |
var value_check = $("#input_1_13-" + rand).val(); |
| 515 |
if (value_check == "Other" || value_check == "other") { |
| 516 |
$("#input_1_14-" + rand).closest(".gfield").addClass("hidden"); |
| 517 |
} else { |
| 518 |
$("#input_1_14-" + rand).closest(".gfield").removeClass("hidden"); |
| 519 |
} |
| 520 |
} |
| 521 |
gform.addAction('gform_input_change', function (elem, formId, fieldId) { |
| 522 |
var datas = $(elem).attr("name").split("__");; |
| 523 |
if (datas.length > 1) { |
| 524 |
conditional_logic_custom(datas[1]); |
| 525 |
} |
| 526 |
}, 10); |
| 527 |
function get_repeater_data(step_field, key = null) { |
| 528 |
var data_html = step_field.find(".gf-field-repeater-data-html").val(); |
| 529 |
if (data_html == "") { |
| 530 |
data_html = step_field.find(".gf-field-repeater-data-html").attr('value'); |
| 531 |
} |
| 532 |
var html_step = change_name_and_ids(data_html, step_field, key); |
| 533 |
return html_step; |
| 534 |
} |
| 535 |
function get_repeater_data_name() { |
| 536 |
var i = 1; |
| 537 |
$(".gfield--type-repeater_start").each(function () { |
| 538 |
if ($(this).data("installed") == "installed") { |
| 539 |
return; |
| 540 |
} |
| 541 |
$(this).data("installed", "installed"); |
| 542 |
$(this).addClass("installed"); |
| 543 |
var html_step = $("<div class='container-repeater-field'></div>"); |
| 544 |
var names = []; |
| 545 |
var step_field = ""; |
| 546 |
var elements = $(this).nextAll(); |
| 547 |
var value = ""; |
| 548 |
elements.each(function (index) { |
| 549 |
var item = $(this).clone(); |
| 550 |
if (item.hasClass("gfield--type-repeater_end")) { |
| 551 |
$(this).attr("data-id", i); |
| 552 |
value = $(this).find("input").val(); |
| 553 |
if (value == "") { |
| 554 |
value = $(this).find("input").attr("value"); |
| 555 |
} |
| 556 |
step_field = $(this); |
| 557 |
$(this).find(".gf-field-repeater-data").val(JSON.stringify({ "count": 1, "fields": names, "id": [] })); |
| 558 |
$(this).find(".gf-field-repeater-data").attr("value", JSON.stringify({ "count": 1, "fields": names, "id": [] })); |
| 559 |
return false; |
| 560 |
} |
| 561 |
$(this).remove(); |
| 562 |
html_step.append(item); |
| 563 |
var check_name = null; |
| 564 |
if (item.find(".ginput_container_fileupload").length > 0) { |
| 565 |
var name = item.find("input[type=file]").attr("name"); |
| 566 |
if (name === undefined) { |
| 567 |
name = item[0].id; |
| 568 |
name = name.split("field"); |
| 569 |
names.push("gform_multifile_upload" + name[1]); |
| 570 |
} else { |
| 571 |
names.push(item.find("input[type=file]").attr("name")); |
| 572 |
} |
| 573 |
} else { |
| 574 |
if (item.find("input").attr("name")) { |
| 575 |
var custom_n = item.find("input").attr("name"); |
| 576 |
custom_n = custom_n.replace(/\[\]$/, ''); |
| 577 |
names.push(custom_n); |
| 578 |
} else if (item.find("textarea").attr("name")) { |
| 579 |
names.push(item.find("textarea").attr("name")); |
| 580 |
} else if (item.find("select").attr("name")) { |
| 581 |
names.push(item.find("select").attr("name")); |
| 582 |
} else { |
| 583 |
var type = item.find("input").attr("type"); |
| 584 |
names.push(item.find("input").attr("name")); |
| 585 |
} |
| 586 |
} |
| 587 |
}) |
| 588 |
var text_html = "<div class='container-repeater-field'>" + html_step.html() + "</div>"; |
| 589 |
step_field.find(".gf-field-repeater-data-html").val(text_html); |
| 590 |
step_field.find(".gf-field-repeater-data-html").attr("value", text_html); |
| 591 |
var initial_rows = 1; |
| 592 |
initial_rows = step_field.find(".repeater-field-warp-item-data").data("initial_rows"); |
| 593 |
var initial_rows_map_field_check = step_field.find(".repeater-field-warp-item-data").data("initial_rows_map_check"); |
| 594 |
if (initial_rows_map_field_check != "" && initial_rows_map_field_check !== undefined) { |
| 595 |
var initial_rows_map_field = step_field.find(".repeater-field-warp-item-data").data("initial_rows_map"); |
| 596 |
var initial_rows_map_number = $("#" + initial_rows_map_field).val(); |
| 597 |
if (initial_rows_map_number == "") { |
| 598 |
initial_rows_map_number = $("#" + initial_rows_map_field).attr("value"); |
| 599 |
} |
| 600 |
if (initial_rows_map_number == "") { |
| 601 |
initial_rows_map_number = 0; |
| 602 |
} |
| 603 |
$("#" + initial_rows_map_field).attr("data-repeater", step_field.find(".repeater-field-warp-item-data").data("map_id")); |
| 604 |
$("#" + initial_rows_map_field).attr("repeater_initial_rows", "ok"); |
| 605 |
initial_rows = initial_rows_map_number; |
| 606 |
step_field.find(".gf-repeater-field-button-add").addClass("hidden"); |
| 607 |
step_field.addClass("repeater-remove-toolbar"); |
| 608 |
} |
| 609 |
if (initial_rows === undefined || initial_rows === "") { |
| 610 |
initial_rows = 1; |
| 611 |
} |
| 612 |
if (value != "") { |
| 613 |
value = JSON.parse(value); |
| 614 |
initial_rows = value.count; |
| 615 |
var data_arr_ids = value.id; |
| 616 |
setTimeout(function () { |
| 617 |
for (var j = 0; j < initial_rows; j++) { |
| 618 |
add_repeater_data(step_field.closest(".gfield--type-repeater_end"), data_arr_ids[j]); |
| 619 |
} |
| 620 |
}, 100); |
| 621 |
} else { |
| 622 |
setTimeout(function () { |
| 623 |
for (var j = 0; j < initial_rows; j++) { |
| 624 |
add_repeater_data(step_field.closest(".gfield--type-repeater_end")); |
| 625 |
} |
| 626 |
}, 100); |
| 627 |
} |
| 628 |
i++; |
| 629 |
}) |
| 630 |
} |
| 631 |
$("body").on("change", "[repeater_initial_rows='ok']", function (e) { |
| 632 |
var repeater_id = $(this).data("repeater"); |
| 633 |
$("#" + repeater_id).find(".repeater-field-item").remove(); |
| 634 |
var number = $(this).val(); |
| 635 |
if (number == "") { |
| 636 |
number = $(this).attr("value"); |
| 637 |
} |
| 638 |
for (let i = 0; i < number; i++) { |
| 639 |
$("#" + repeater_id).find(".gf-repeater-field-button-add").click(); |
| 640 |
} |
| 641 |
}) |
| 642 |
function get_repeater_data_header(start_field) { |
| 643 |
var html_step = start_field.find(".repeater-field-header-data").val(); |
| 644 |
if (html_step == "") { |
| 645 |
html_step = start_field.find(".repeater-field-header-data").attr("value"); |
| 646 |
} |
| 647 |
return html_step; |
| 648 |
} |
| 649 |
function update_repeater_count_header() { |
| 650 |
$(".gfield--type-repeater_end").each(function () { |
| 651 |
var i = 1; |
| 652 |
$(".repeater-field-item", $(this)).each(function () { |
| 653 |
$(this).find(".repeater-field-header-count").html(i); |
| 654 |
i++; |
| 655 |
}) |
| 656 |
var data_js = $(this).find(".gf-field-repeater-data").val(); |
| 657 |
if (data_js == "") { |
| 658 |
$(this).find(".gf-field-repeater-data").attr("value"); |
| 659 |
} |
| 660 |
var datas = JSON.parse(data_js); |
| 661 |
datas.count = i - 1; |
| 662 |
$(this).find(".gf-field-repeater-data").val(JSON.stringify(datas)); |
| 663 |
$(this).find(".gf-field-repeater-data").attr("value", JSON.stringify(datas)); |
| 664 |
}); |
| 665 |
} |
| 666 |
function check_max_row(step_field) { |
| 667 |
var max = step_field.find(".repeater-field-warp-item-data").data("limit"); |
| 668 |
var number_item = $('.repeater-field-item', step_field).length; |
| 669 |
if (number_item >= max) { |
| 670 |
return false; |
| 671 |
} else { |
| 672 |
return true; |
| 673 |
} |
| 674 |
} |
| 675 |
function check_min_row(step_field) { |
| 676 |
var min = step_field.find(".repeater-field-warp-item-data").data("initial_rows"); |
| 677 |
var number_item = $('.repeater-field-item', step_field).length; |
| 678 |
if (number_item <= min) { |
| 679 |
return false; |
| 680 |
} else { |
| 681 |
return true; |
| 682 |
} |
| 683 |
} |
| 684 |
function removeAR(arr) { |
| 685 |
var what, a = arguments, L = a.length, ax; |
| 686 |
while (L > 1 && arr.length) { |
| 687 |
what = a[--L]; |
| 688 |
while ((ax = arr.indexOf(what)) !== -1) { |
| 689 |
arr.splice(ax, 1); |
| 690 |
} |
| 691 |
} |
| 692 |
return arr; |
| 693 |
} |
| 694 |
$("body").on("click", ".gf-repeater-field-button-add", function (e) { |
| 695 |
e.preventDefault(); |
| 696 |
if (check_max_row($(this).closest(".gfield--type-repeater_end"))) { |
| 697 |
add_repeater_data($(this).closest(".gfield--type-repeater_end")); |
| 698 |
} else { |
| 699 |
$(this).addClass('hidden'); |
| 700 |
} |
| 701 |
}) |
| 702 |
$("body").on("click", ".repeater-field-header-acctions-toogle", function (e) { |
| 703 |
e.preventDefault(); |
| 704 |
if ($(this).hasClass("icon-down-open")) { |
| 705 |
$(this).removeClass("icon-down-open"); |
| 706 |
$(this).addClass("icon-up-open"); |
| 707 |
} else { |
| 708 |
$(this).addClass("icon-down-open"); |
| 709 |
$(this).removeClass("icon-up-open"); |
| 710 |
} |
| 711 |
$(this).closest(".repeater-field-item").find(".repeater-field-content").slideToggle("slow"); |
| 712 |
$(this).closest(".repeater-field-item").find(".repeater-field-header").toggleClass('repeater-content-show'); |
| 713 |
}) |
| 714 |
$("body").on("click", ".repeater-field-header-acctions-remove", function (e) { |
| 715 |
e.preventDefault(); |
| 716 |
$(this).closest(".gfield--type-repeater_end").find(".gf-repeater-field-button-add").removeClass('hidden'); |
| 717 |
if (check_min_row($(this).closest(".gfield--type-repeater_end"))) { |
| 718 |
var id = $(this).closest(".repeater-field-item").find(".container-repeater-field").data("id"); |
| 719 |
var data_js = $(this).closest(".gfield--type-repeater_end").find(".gf-field-repeater-data").val(); |
| 720 |
if (data_js == "") { |
| 721 |
data_js = $(this).closest(".gfield--type-repeater_end").find(".gf-field-repeater-data").attr("value"); |
| 722 |
} |
| 723 |
var datas = JSON.parse(data_js); |
| 724 |
var datas_ids = datas.id; |
| 725 |
datas_ids = removeAR(datas_ids, id); |
| 726 |
datas.id = datas_ids; |
| 727 |
$(this).closest(".gfield--type-repeater_end").find(".gf-field-repeater-data").val(JSON.stringify(datas)); |
| 728 |
$(this).closest(".gfield--type-repeater_end").find(".gf-field-repeater-data").attr("value", JSON.stringify(datas)); |
| 729 |
$(this).closest(".repeater-field-item").remove(); |
| 730 |
} else { |
| 731 |
} |
| 732 |
update_repeater_count_header(); |
| 733 |
}) |
| 734 |
//date pick |
| 735 |
function getDatepickerI18n() { |
| 736 |
var i18n = gform_i18n.datepicker; |
| 737 |
return { |
| 738 |
dayNamesMin: [ |
| 739 |
i18n.days.sunday, |
| 740 |
i18n.days.monday, |
| 741 |
i18n.days.tuesday, |
| 742 |
i18n.days.wednesday, |
| 743 |
i18n.days.thursday, |
| 744 |
i18n.days.friday, |
| 745 |
i18n.days.saturday, |
| 746 |
], |
| 747 |
monthNamesShort: [ |
| 748 |
i18n.months.january, |
| 749 |
i18n.months.february, |
| 750 |
i18n.months.march, |
| 751 |
i18n.months.april, |
| 752 |
i18n.months.may, |
| 753 |
i18n.months.june, |
| 754 |
i18n.months.july, |
| 755 |
i18n.months.august, |
| 756 |
i18n.months.september, |
| 757 |
i18n.months.october, |
| 758 |
i18n.months.november, |
| 759 |
i18n.months.december, |
| 760 |
], |
| 761 |
firstDay: i18n.firstDay, |
| 762 |
iconText: i18n.iconText, |
| 763 |
}; |
| 764 |
} |
| 765 |
/** |
| 766 |
* @function getDatepickerBaseOptions |
| 767 |
* @description Return base options object that configures the datepicker. |
| 768 |
* @param $element The datepicker trigger. |
| 769 |
* @since 2.5 |
| 770 |
* |
| 771 |
* @returns {{ |
| 772 |
* suppressDatePicker: boolean, |
| 773 |
* changeMonth: boolean, |
| 774 |
* changeYear: boolean, |
| 775 |
* onClose: onClose, |
| 776 |
* yearRange: string, |
| 777 |
* dateFormat: string, |
| 778 |
* showOn: string, |
| 779 |
* dayNamesMin: *[], |
| 780 |
* monthNamesShort: *[], |
| 781 |
* beforeShow: (function(*, *): boolean), |
| 782 |
* showOtherMonths: boolean |
| 783 |
* }} |
| 784 |
*/ |
| 785 |
function getDatepickerBaseOptions($element) { |
| 786 |
var i18n = getDatepickerI18n(); |
| 787 |
var isThemeDatepicker = $element.closest('.gform_wrapper').length > 0; |
| 788 |
var isPreview = $('#preview_form_container').length > 0; |
| 789 |
var isRTL = window.getComputedStyle($element[0], null).getPropertyValue('direction') === 'rtl'; |
| 790 |
var formTheme = isThemeDatepicker ? $element.closest('.gform_wrapper').data('form-theme') : 'gravity-theme'; |
| 791 |
var formId = isThemeDatepicker ? $element.closest('.gform_wrapper').attr('id').replace('gform_wrapper_', '') : ''; |
| 792 |
var formPageInstance = isThemeDatepicker ? $element.closest('.gform_wrapper').attr('data-form-index') : ''; |
| 793 |
return { |
| 794 |
yearRange: '-100:+20', |
| 795 |
showOn: 'focus', |
| 796 |
dateFormat: 'mm/dd/yy', |
| 797 |
dayNamesMin: i18n.dayNamesMin, |
| 798 |
monthNamesShort: i18n.monthNamesShort, |
| 799 |
firstDay: i18n.firstDay, |
| 800 |
changeMonth: true, |
| 801 |
changeYear: true, |
| 802 |
isRTL: isRTL, |
| 803 |
showOtherMonths: isThemeDatepicker, |
| 804 |
suppressDatePicker: false, |
| 805 |
onClose: function () { |
| 806 |
var self = this; |
| 807 |
$element.focus(); |
| 808 |
this.suppressDatePicker = true; |
| 809 |
setTimeout(function () { |
| 810 |
self.suppressDatePicker = false; |
| 811 |
}, 200); |
| 812 |
}, |
| 813 |
beforeShow: function (input, inst) { |
| 814 |
// Remove any classes that were added before as it could have been added to a different datepicker. |
| 815 |
inst.dpDiv[0].classList.remove('gform-theme-datepicker'); |
| 816 |
inst.dpDiv[0].classList.remove('gravity-theme'); |
| 817 |
inst.dpDiv[0].classList.remove('gform-theme'); |
| 818 |
inst.dpDiv[0].classList.remove('gform-legacy-datepicker'); |
| 819 |
inst.dpDiv[0].classList.remove('gform-theme--framework'); |
| 820 |
inst.dpDiv[0].classList.remove('gform-theme--foundation'); |
| 821 |
inst.dpDiv[0].classList.remove('gform-theme--orbital'); |
| 822 |
if (isThemeDatepicker) { |
| 823 |
inst.dpDiv[0].classList.add('gform-theme-datepicker'); |
| 824 |
$(inst.dpDiv[0]).attr('data-parent-form', formId + '_' + formPageInstance); |
| 825 |
} |
| 826 |
if (formTheme === undefined || formTheme === 'gravity-theme') { |
| 827 |
$(inst.dpDiv[0]).addClass('gravity-theme'); |
| 828 |
} else if (formTheme === 'legacy') { |
| 829 |
$(inst.dpDiv[0]).addClass('gform-legacy-datepicker'); |
| 830 |
} |
| 831 |
else { |
| 832 |
$(inst.dpDiv[0]).addClass('gform-theme--' + formTheme); |
| 833 |
if (formTheme === 'orbital') { |
| 834 |
$(inst.dpDiv[0]).addClass('gform-theme--framework'); |
| 835 |
$(inst.dpDiv[0]).addClass('gform-theme--foundation'); |
| 836 |
} |
| 837 |
} |
| 838 |
if (isRTL && isPreview) { |
| 839 |
var $inputContainer = $(input).closest('.gfield'); |
| 840 |
var rightOffset = $(document).outerWidth() - ($inputContainer.offset().left + $inputContainer.outerWidth()); |
| 841 |
inst.dpDiv[0].style.right = rightOffset + 'px'; |
| 842 |
} |
| 843 |
return !this.suppressDatePicker; |
| 844 |
}, |
| 845 |
}; |
| 846 |
} |
| 847 |
/** |
| 848 |
* @function initSingleDatepicker |
| 849 |
* @description Initialize a datepicker assigning various additional options based on the trigger element. |
| 850 |
* @param $element The datepicker trigger. |
| 851 |
* @since 2.4 |
| 852 |
*/ |
| 853 |
function initSingleDatepicker($element) { |
| 854 |
var i18n = getDatepickerI18n(); |
| 855 |
var inputId = $element.attr('id') ? $element.attr('id') : ''; |
| 856 |
var optionsObj = getDatepickerBaseOptions($element); |
| 857 |
if ($element.hasClass('dmy')) { |
| 858 |
optionsObj.dateFormat = 'dd/mm/yy'; |
| 859 |
} else if ($element.hasClass('dmy_dash')) { |
| 860 |
optionsObj.dateFormat = 'dd-mm-yy'; |
| 861 |
} else if ($element.hasClass('dmy_dot')) { |
| 862 |
optionsObj.dateFormat = 'dd.mm.yy'; |
| 863 |
} else if ($element.hasClass('ymd_slash')) { |
| 864 |
optionsObj.dateFormat = 'yy/mm/dd'; |
| 865 |
} else if ($element.hasClass('ymd_dash')) { |
| 866 |
optionsObj.dateFormat = 'yy-mm-dd'; |
| 867 |
} else if ($element.hasClass('ymd_dot')) { |
| 868 |
optionsObj.dateFormat = 'yy.mm.dd'; |
| 869 |
} |
| 870 |
if ($element.hasClass('gdatepicker_with_icon')) { |
| 871 |
optionsObj.showOn = 'both'; |
| 872 |
optionsObj.buttonImage = $element.parent().siblings("[id^='gforms_calendar_icon_input']").val(); |
| 873 |
optionsObj.buttonImageOnly = true; |
| 874 |
optionsObj.buttonText = i18n.iconText; |
| 875 |
} else { |
| 876 |
optionsObj.showOn = 'focus'; |
| 877 |
} |
| 878 |
inputId = inputId.split('_'); |
| 879 |
// allow the user to override the datepicker options object |
| 880 |
optionsObj = gform.applyFilters('gform_datepicker_options_pre_init', optionsObj, inputId[1], inputId[2], $element); |
| 881 |
$element.datepicker(optionsObj); |
| 882 |
// We give the input focus after selecting a date which differs from default Datepicker behavior; this prevents |
| 883 |
// users from clicking on the input again to open the datepicker. Let's add a manual click event to handle this. |
| 884 |
if ($element.is(':input')) { |
| 885 |
$element.click(function () { |
| 886 |
$element.datepicker('show'); |
| 887 |
}); |
| 888 |
} |
| 889 |
} |
| 890 |
}) |
| 891 |
$(document).on("change", ".gfield--type-repeater_end input,.gfield--type-repeater_end textarea,.gfield--type-repeater_end select", function (event) { |
| 892 |
var id = $(this).attr("id"); |
| 893 |
if (typeof (Storage) !== "undefined") { |
| 894 |
if ($(this).attr("name") != "" && typeof $(this).attr("name") != 'undefined') { |
| 895 |
var type = $(this).attr("type"); |
| 896 |
var name = $(this).attr("id"); |
| 897 |
if (type == "checkbox") { |
| 898 |
if ($("#" + name + ":checked").length > 0) { |
| 899 |
var value = $("#" + name + ":checked").val(); |
| 900 |
localStorage.setItem(id, value); |
| 901 |
} else { |
| 902 |
localStorage.removeItem(id); |
| 903 |
} |
| 904 |
} else if (type == "radio") { |
| 905 |
var id = $(this).attr("name"); |
| 906 |
var value = $(this).val(); |
| 907 |
localStorage.setItem(id, value); |
| 908 |
} |
| 909 |
else { |
| 910 |
var value = $(this).val(); |
| 911 |
localStorage.setItem(id, value); |
| 912 |
} |
| 913 |
} |
| 914 |
} |
| 915 |
}); |
| 916 |
})(jQuery); |