1(function ($) { 2 //jQuery time 3 var current_fs, next_fs, previous_fs; //fieldsets 4 var left, opacity, scale; //fieldset properties which we will animate 5 var animating; //flag to prevent quick multi-click glitches 6 var has_response = false; 7 var preview_clicked = false; 8 var next_clicked = false; 9 var step_click = false; 10 11 jQuery(document).ready(function ($) { 12 if(typeof next_clicked === 'undefined') 13 next_clicked = false; 14 if(typeof has_response === 'undefined') 15 has_response = false; 16 if(typeof preview_clicked === 'undefined') 17 preview_clicked = false; 18 if(typeof step_click === 'undefined') 19 step_click = false; 20 if($("form.wpcf7-form .cf7mls_progress_bar.cf7mls_bar_style_box_larerSign_squaren").height() >= 100) { 21 $('head').append('<style>.cf7mls_bar_style_box_larerSign_squaren.cf7mls_bar_style_text_vertical li:after{width: 74px;height: 74px;left: -36px;}</style>'); 22 } 23 // Transition effects 24 $("form.wpcf7-form").each(function (index, el) { 25 cf7mls_transition_effects(el, 'effects_in'); 26 }); 27 28 $("form.wpcf7-form").each(function (index, el) { 29 var totalFieldset = 0; 30 var this_form = $(el); 31 var findFieldset = $(el).find("fieldset.fieldset-cf7mls"); 32 if (findFieldset.length > 0) { 33 this_form.addClass('cf7mls') 34 $.each(findFieldset, function (i2, el2) { 35 if (i2 == 0) { 36 $(el2).addClass("cf7mls_current_fs"); 37 } 38 39 jQuery(el2).attr("data-cf7mls-order", i2); 40 totalFieldset = totalFieldset + 1; 41 //disable next button if the fieldset has wpcf7-acceptances 42 var acceptances = jQuery(el2).find("input:checkbox.wpcf7-acceptances"); 43 if (acceptances.length) { 44 cf7mls_toggle_next_btn(acceptances, el2); 45 } 46 }); 47 $.each(findFieldset, function (i2, el2) { 48 if (i2 == totalFieldset - 1) { 49 $(el2) 50 .find(".cf7mls_next") 51 .remove(); 52 } 53 }); 54 $(el).attr("data-count-fieldset", totalFieldset); 55 //on form submit 56 if(cf7mls_object.disable_submit == 'true') { 57 if (cf7mls_object.disable_enter_key) { 58 $(el) 59 .find('[type="submit"]') 60 .click(function (event) { 61 var findFieldset = $(el).find( 62 "fieldset.fieldset-cf7mls.cf7mls_current_fs" 63 ); 64 if (findFieldset.data("cf7mls-order") != totalFieldset - 1) { 65 findFieldset.find(".cf7mls_next").click(); 66 return false; 67 } 68 }); 69 } else { 70 $(el).submit(function (event) { 71 var findFieldset = $(el).find( 72 "fieldset.fieldset-cf7mls.cf7mls_current_fs" 73 ); 74 if (findFieldset.data("cf7mls-order") != totalFieldset - 1) { 75 findFieldset.find(".cf7mls_next").click(); 76 return false; 77 } 78 }); 79 } 80 } 81 } 82 //recall fields 83 $(el) 84 .find("input.wpcf7-cf7_recall") 85 .each(function (njt_a_i, njt_a_e) { 86 var $this = $(njt_a_e); 87 var qf = this_form.find('[name="' + $this.data("qf") + '"]'); 88 var sp = $("span.wpcf7-cf7_recall_" + $this.data("qf")); 89 var arrChecked = []; 90 91 var isCheckbox = false; 92 if($this.length > 0) { 93 isCheckbox = $this.data("qf") !== undefined && $this.data("qf").indexOf("cbmls") >= 0 ? true : false; 94 } 95 96 if (isCheckbox) { 97 qf = this_form.find('[name="' + $this.data("qf") + "[]" + '"]'); 98 if(qf.length === 0) { 99 qf = this_form.find('[name="' + $this.data("qf") + '"]'); 100 } 101 qf.each(function( index ) { 102 var _val = $(this).val(); 103 if( $(this).attr('type') == 'date' ) { 104 const D = new Date(_val); 105 _val = getFormattedDate(D); 106 } 107 var arrCheckedIndex = $.inArray(_val, arrChecked); 108 if (this.checked) { 109 if (arrCheckedIndex === -1) 110 arrChecked.push(_val); 111 sp.text(arrChecked.toString()); 112 $this.val(arrChecked.toString()); 113 } 114 }); 115 qf.on("change", function (event) { 116 event.preventDefault(); 117 var _val = $(this).val(); 118 if( $(this).attr('type') == 'date' ) { 119 const D = new Date(_val); 120 _val = getFormattedDate(D); 121 } 122 var arrCheckedIndex = $.inArray(_val, arrChecked); 123 if (this.checked) { 124 if (arrCheckedIndex === -1) arrChecked.push(_val); 125 } else { 126 arrChecked.splice(arrCheckedIndex, 1); 127 } 128 sp.text(arrChecked.toString()); 129 $this.val(arrChecked.toString()); 130 }); 131 } else { 132 if (qf.val()) { 133 var _val = qf.val(); 134 sp.text(_val); 135 $this.val(_val); 136 } 137 qf.on("change", function (event) { 138 event.preventDefault(); 139 var _val = $(this).val(); 140 if( $(this).attr('type') == 'date' ) { 141 const D = new Date(_val); 142 _val = getFormattedDate(D); 143 } 144 sp.text(_val); 145 $this.val(_val); 146 }); 147 } 148 }); 149 }); 150
151 // Background Color Progress Bar 152 $("form.wpcf7-form").each(function (index, el) { 153 let id_form = $(el).find('.cf7mls_progress_bar').attr('data-id-form'); 154 var progress_bar_bg_color = $(el).find('.cf7mls_progress_bar').attr('data-bg-color'); 155 $('head').append('<style id="cf7mls_style_progress_bar_' + id_form + '" type="text/css"></style>'); 156 if(progress_bar_bg_color && id_form) { 157 cf7mls_color_bar(progress_bar_bg_color, id_form, el); 158 } 159 }); 160 161 jQuery(document).on( 162 "click", 163 "form.wpcf7-form input:checkbox.wpcf7-acceptances", 164 function (event) { 165 //event.preventDefault(); 166 var $this = jQuery(this); 167 var parent_fieldset = $this.closest("fieldset.fieldset-cf7mls"); 168 if (parent_fieldset.length) { 169 var acceptances = jQuery(parent_fieldset).find( 170 "input:checkbox.wpcf7-acceptances" 171 ); 172 if (acceptances.length) { 173 cf7mls_toggle_next_btn(acceptances, parent_fieldset); 174 } 175 } 176 } 177 ); 178 179 $(document).on("click", ".cf7mls_next", function (event) { 180 if(next_clicked == false) { 181 next_clicked = true; 182 event.preventDefault(); 183 var $this = $(this); 184 $this.addClass("sending"); 185 current_fs = $this.closest(".fieldset-cf7mls"); 186 next_fs = current_fs.next(); 187 188 var form = $this.parent().closest("form.wpcf7-form"); 189 if(form.hasClass("sent")) { 190 form.removeClass("sent"); 191 form.addClass("init"); 192 form.attr('data-status', 'init'); 193 if (form.find('.wpcf7-response-output').length) { 194 form.find('.wpcf7-response-output').html(""); 195 } 196 } 197 198 //signature fields 199 current_fs.find('.wpcf7-form-control-signature-global-wrap').each(function(j, wrapper){ 200 var f_id = $(wrapper).attr('data-field-id') 201 var canvas = $(wrapper).find('canvas') 202 if(typeof signatures != 'undefined') { 203 $.each(signatures, function(s_i, signature){ 204 if(signature.canvas.id == canvas.attr('id')) { 205 if (!signature.signature.isEmpty()){ 206 $('input[name="'+f_id+'"]').val(signature.canvas.toDataURL()) 207 }else{ 208 $('input[name="'+f_id+'"]').val("") 209 } 210 211 } 212 }) 213 } 214 }); 215 216 var fd = new FormData(form[0]); 217 // var fileFields = $(form).find('input[type="file"]'); 218 // $.each(fileFields, function (index, el) { 219 // if($(el)[0].files.length > 0) { 220 // $.each($(el)[0].files, function (index, file) { 221 // fd.append($(el).attr("name"), file); 222 // }); 223 // } else { 224 // fd.append($(el).attr("name"), undefined) 225 // } 226 227 // }); 228 229 $.ajax({ 230 url: cf7mls_object.ajax_url + "v1/cf7mls_validation", 231 type: "POST", 232 crossDomain: true, 233 data: fd, 234 processData: false, 235 contentType: false 236 }) 237 .done(function (json) { 238 $this.removeClass("sending"); 239 240 /* 241 * Insert _form_data_id if 'json variable' has 242 */ 243 if (typeof json._cf7mls_db_form_data_id != "undefined") { 244 if (!form.find('input[name="_cf7mls_db_form_data_id"]').length) { 245 form.append( 246 '<input type="hidden" name="_cf7mls_db_form_data_id" value="' + 247 json._cf7mls_db_form_data_id + 248 '" />' 249 ); 250 } 251 } 252 253 if (!json.success) { 254 var checkError = 0; 255 var firstError = null; 256 //reset error messages 257 current_fs 258 .find(".wpcf7-form-control-wrap") 259 .removeClass("cf7mls-invalid"); 260 current_fs.find(".cf7mls-invalid").removeClass("cf7mls-invalid"); 261 262 current_fs 263 .find(".wpcf7-form-control-wrap .wpcf7-not-valid-tip") 264 .remove(); 265 266 current_fs 267 .find(".wpcf7-form-control-wrap .wpcf7-not-valid") 268 .removeClass("wpcf7-not-valid"); 269 270 if (has_response) { 271 current_fs 272 .find(".wpcf7-response-output.wpcf7-validation-errors") 273 .removeClass("wpcf7-validation-errors"); 274 } else { 275 current_fs 276 .find(".wpcf7-response-output.wpcf7-validation-errors") 277 .remove(); 278 } 279 $.each(json.invalid_fields, function (index, el) { 280 if ( 281 current_fs.find('input[name="' + index + '"]').length || 282 current_fs.find('input[name="' + index + '[]"]').length || 283 current_fs.find('select[name="' + index + '"]').length || 284 current_fs.find('select[name="' + index + '[]"]').length || 285 current_fs.find('textarea[name="' + index + '"]').length || 286 current_fs.find('textarea[name="' + index + '[]"]').length || 287 current_fs.find('input[data-name="' + index + '"]').length || 288 current_fs.find('input[data-name="' + index + '[]"]').length 289 ) { 290 checkError = checkError + 1; 291 292 //var controlWrap = $('.wpcf7-form-control-wrap.' + index, form); 293 var controlWraps = [ 294 $('[name="' + index + '"]', form).parent(), 295 $('[name="' + index + '[]"]', form).parent(), 296 $('[data-name="' + index + '"]', form).parent(), 297 $('[data-name="' + index + '[]"]', form).parent() 298 ]; 299 $.each(controlWraps, function (i1, e1) { 300 if(e1.hasClass("wpcf7-form-control-wrap") || e1.parents(".wpcf7-form-control-wrap").length || e1.parents(".wpcf7-checkbox").length || e1.parents(".wpcf7-radio").length) { 301 var _c = "wpcf7-not-valid-tip"; 302 if (e1.hasClass("form-group")) { 303 e1.addClass("has-error"); 304 _c += " help-block"; 305 } 306 if(firstError === null) { 307 firstError = e1; 308 } 309 e1.addClass("cf7mls-invalid"); 310 e1.find("span.wpcf7-not-valid-tip").remove(); 311 e1.find(".wpcf7-validates-as-required").addClass( 312 "wpcf7-not-valid" 313 ); 314 if (e1.parents(".wpcf7-checkbox").length) { 315 e1.parents(".wpcf7-checkbox").after( 316 '<span role="alert" class="' + 317 _c + 318 '">' + 319 el.reason + 320 "</span>" 321 ); 322 } else if (e1.parents(".wpcf7-radio").length) { 323 e1.parents(".wpcf7-radio").after( 324 '<span role="alert" class="' + 325 _c + 326 '">' + 327 el.reason + 328 "</span>" 329 ); 330 } else if (e1.parents(".wpcf7-form-control-wrap").length) { 331 e1.parents(".wpcf7-form-control-wrap").append( 332 '<span role="alert" class="' + 333 _c + 334 '">' + 335 el.reason + 336 "</span>" 337 ); 338 } else { 339 e1.append( 340 '<span role="alert" class="' + 341 _c + 342 '">' + 343 el.reason + 344 "</span>" 345 ); 346 } 347 } 348 }); 349 350 //return false;
351 } 352 }); 353 354 if (checkError == 0) { 355 json.success = true; 356 has_response = false; 357 // jQuery("html, body").animate( 358 // { 359 // scrollTop: jQuery($this.closest("form")).offset().top - 110 360 // }, 361 // 1000 362 // ); 363 } else { 364 $('html, body').animate({ 365 scrollTop: $(firstError).offset().top - 100 366 }, 500); 367 if (current_fs.find(".wpcf7-response-output").length) { 368 has_response = true; 369 370 $icon = ''; 371 $icon += '<svg class="wpcf7-icon-wraning" width="18px" height="18px" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">'; 372 $icon += '<g><path d="M499.9,361.6c-12.7,0-23,10.3-23,23v352.2c0,12.7,10.3,23,23,23s23-10.3,23-23V384.6C522.9,371.9,512.6,361.6,499.9,361.6z"/>'; 373 $icon += '<path d="M500.1,240.2c-12.7,0-23,10.3-23,23v30.6c0,12.7,10.3,23,23,23c12.7,0,23-10.3,23-23v-30.6C523.1,250.5,512.8,240.2,500.1,240.2z"/>'; 374 $icon += '<path d="M500,10C229.4,10,10,229.4,10,500c0,270.6,219.4,490,490,490c270.6,0,490-219.4,490-490C990,229.4,770.6,10,500,10z M500,944.1C254.8,944.1,55.9,745.2,55.9,500C55.9,254.8,254.8,55.9,500,55.9S944.1,254.8,944.1,500C944.1,745.2,745.2,944.1,500,944.1z"/></g></svg>'; 375 current_fs 376 .find(".wpcf7-response-output") 377 .addClass("wpcf7-validation-errors") 378 .show() 379 .html($icon + json.message); 380 } else { 381 has_response = false; 382 $icon = ''; 383 $icon += '<svg class="wpcf7-icon-wraning" width="18px" height="18px" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">'; 384 $icon += '<g><path d="M499.9,361.6c-12.7,0-23,10.3-23,23v352.2c0,12.7,10.3,23,23,23s23-10.3,23-23V384.6C522.9,371.9,512.6,361.6,499.9,361.6z"/>'; 385 $icon += '<path d="M500.1,240.2c-12.7,0-23,10.3-23,23v30.6c0,12.7,10.3,23,23,23c12.7,0,23-10.3,23-23v-30.6C523.1,250.5,512.8,240.2,500.1,240.2z"/>'; 386 $icon += '<path d="M500,10C229.4,10,10,229.4,10,500c0,270.6,219.4,490,490,490c270.6,0,490-219.4,490-490C990,229.4,770.6,10,500,10z M500,944.1C254.8,944.1,55.9,745.2,55.9,500C55.9,254.8,254.8,55.9,500,55.9S944.1,254.8,944.1,500C944.1,745.2,745.2,944.1,500,944.1z"/></g></svg>'; 387 388 current_fs.append( 389 '<div class="wpcf7-response-output wpcf7-display-none wpcf7-validation-errors" style="display: block;" role="alert">' + $icon + 390 json.message + 391 "</div>" 392 393 394 ); 395 } 396 } 397 } 398 399 if (json.success) { 400 /* 401 current_fs.fadeOut('400', function() { 402 next_fs.fadeIn('400'); 403 }); 404 405 }); 406 */ 407 408 //reset error messages 409 current_fs 410 .find(".wpcf7-form-control-wrap") 411 .removeClass("cf7mls-invalid"); 412 current_fs.find(".cf7mls-invalid").removeClass("cf7mls-invalid"); 413 current_fs.find(".wpcf7-not-valid").removeClass("wpcf7-not-valid"); 414 current_fs 415 .find(".wpcf7-form-control-wrap .wpcf7-not-valid-tip") 416 .remove(); 417 418 /* 419 * Instead of hiding current fs, we hide all 420 */ 421 /* 422 current_fs.css({ 423 height: '0px', 424 overflow: 'hidden', 425 opacity: '0', 426 'visibility': 'hidden' 427 }).removeClass('cf7mls_current_fs'); 428 */ 429 430 form.find(".cf7mls_current_fs").addClass("cf7mls_back_fs"); 431 432 form.find(".fieldset-cf7mls").removeClass("cf7mls_current_fs"); 433 434 next_fs.addClass("cf7mls_current_fs"); 435 next_fs.find('input, textarea').first().focus(); 436 437 if (form.find(".cf7mls_progress_bar").length) { 438 let allow_choose_step = form.find('.cf7mls_progress_bar').attr('data-allow-choose-step'); 439 let order_cur = Number(form.find('fieldset.cf7mls-choose-step').attr('data-cf7mls-order')); 440 let step_cur = Number(form.find(".cf7mls_progress_bar li.current").attr('data-counter')) - 1; 441 442 // allow choose step 443 if(allow_choose_step === 'on') {
444 form.find('fieldset.fieldset-cf7mls').css({display: ''}); 445 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls-choose-step"); 446 for (let index = 0; index < step_cur; index++) { 447 if(!$("form fieldset.fieldset-cf7mls[data-cf7mls-order="+index+"]").hasClass('cf7mls_back_fs')){ 448 $("form fieldset.fieldset-cf7mls[data-cf7mls-order="+index+"]").addClass('cf7mls_back_fs'); 449 } 450 } 451 } 452 453 if((allow_choose_step === 'on') && 454 ((order_cur !== step_cur) && ((order_cur === 0) || order_cur)) 455 ) { 456 457 $('form .cf7mls_progress_bar li.cf7_mls_steps_item').each(function( index) { 458 if($(this).hasClass('choose-step')) { 459 $(this).removeClass('choose-step'); 460 } 461 }); 462 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_back_fs"); 463 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_current_fs"); 464 465 form.find('fieldset.fieldset-cf7mls').each(function( index, el ) { 466 if(index > step_cur) { 467 return; 468 } 469 $(el).addClass("cf7mls_back_fs"); 470 471 if(index === step_cur) { 472 $(el).removeClass("cf7mls_back_fs"); 473 $(el).addClass("cf7mls_current_fs"); 474 } 475 }); 476 }else { 477 var cur = form.find("fieldset.fieldset-cf7mls").index(current_fs); 478 var nex = form.find("fieldset.fieldset-cf7mls").index(next_fs); 479 // if(cf7mls_object.is_rtl == '1') { 480 // cur = 0 - cur 481 // nex = 0 - nex 482 // } 483 form 484 .find(".cf7mls_progress_bar li") 485 .eq(cur) 486 .removeClass("current"); 487 form 488 .find(".cf7mls_progress_bar li") 489 .eq(nex) 490 .addClass("active current"); 491 492 cf7mls_step_item_finish(cur, nex, form, 'next'); 493 cf7mls_icon_check(form,'next'); 494 495 } 496 } 497 498 499 // Progress Bar in ipad and mobie phone 500 if(form.find(".cf7mls_number_step_wrap").length) { 501 cf7mls_bar_process(form); 502 } 503 504 cf7mls_transition_effects(form, 'effects_next'); 505 506 dhScrollTo(form); 507 return false; 508 } else {} 509 next_clicked = false; 510 }) 511 .fail(function () { 512 $this.removeClass("sending"); 513 next_clicked = false; 514 // console.log("Validation error"); 515 }) 516 .always(function () { 517 $this.removeClass("sending"); 518 next_clicked = false; 519 // console.log("Validation complete"); 520 }); 521 522 return false; 523 } 524 }); 525 526 $(document).on("click", ".cf7mls_back", function (event) { 527 var $this = $(this); 528 var form = $this.parent().closest("form.wpcf7-form"); 529 530 $(".wpcf7-response-output.wpcf7-display-none") 531 .removeClass("wpcf7-validation-errors") 532 .removeAttr("style") 533 .html(""); 534 $(".wpcf7-response-output.wpcf7-display-none.wpcf7-mail-sent-ok").hide(); 535 536 current_fs = $this.closest(".fieldset-cf7mls"); 537 previous_fs = current_fs.prev(); 538 539 //reset error messages 540 current_fs.find(".wpcf7-form-control-wrap").removeClass("cf7mls-invalid"); 541 current_fs.find(".cf7mls-invalid").removeClass("cf7mls-invalid"); 542 current_fs.find(".wpcf7-not-valid").removeClass("wpcf7-not-valid"); 543 current_fs.find(".wpcf7-form-control-wrap .wpcf7-not-valid-tip").remove(); 544 545 /* 546 * Instead of hide current fs, we hide all 547 */ 548 /*current_fs.css({ 549 height: '0px', 550 overflow: 'hidden', 551 opacity: '0', 552 'visibility': 'hidden' 553 }).removeClass('cf7mls_current_fs');*/ 554 form.find(".fieldset-cf7mls").removeClass("cf7mls_current_fs"); 555 556 previous_fs.addClass("cf7mls_current_fs").removeClass("cf7mls_back_fs"); 557 558 if (form.find(".cf7mls_progress_bar").length) {
559 form.find('fieldset.fieldset-cf7mls').css({display: ''}); 560 let allow_choose_step = form.find('.cf7mls_progress_bar').attr('data-allow-choose-step'); 561 let order_cur = Number(form.find('fieldset.cf7mls-choose-step').attr('data-cf7mls-order')); 562 let step_cur = Number(form.find(".cf7mls_progress_bar li.choose-step").attr('data-counter')) - 1; 563 if((allow_choose_step === 'on') && 564 ((order_cur !== step_cur) && ((order_cur === 0) || order_cur)) 565 ) { 566 $('form .cf7mls_progress_bar li.cf7_mls_steps_item').each(function( index) { 567 if($(this).hasClass('choose-step')) { 568 $(this).removeClass('choose-step'); 569 $(this).addClass('active'); 570 $(this).addClass('current'); 571 if($(this).next().hasClass('cf7mls-steps-item-finish')) { 572 $(this).next().removeClass('active'); 573 $(this).next().removeClass('current'); 574 } 575 } else { 576 if($(this).hasClass('active') && $(this).hasClass('current') && !$(this).hasClass('cf7mls-steps-item-finish') ) { 577 $(this).removeClass('active'); 578 $(this).removeClass('current'); 579 } 580 } 581 }); 582 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_back_fs"); 583 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_current_fs"); 584 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls-choose-step"); 585 586 form.find('fieldset.fieldset-cf7mls').each(function( index, el ) { 587 if(index > step_cur) { 588 return; 589 } 590 $(el).addClass("cf7mls_back_fs"); 591 if(index === step_cur) { 592 $(el).removeClass("cf7mls_back_fs"); 593 $(el).addClass("cf7mls_current_fs"); 594 } 595 }); 596 }else { 597 var pre = form.find("fieldset.fieldset-cf7mls").index(previous_fs) 598 var cur = form.find("fieldset.fieldset-cf7mls").index(current_fs) 599 // if(cf7mls_object.is_rtl == '1') { 600 // pre = 0 - pre 601 // cur = 0 - cur 602 // } 603 form 604 .find(".cf7mls_progress_bar li") 605 .eq(pre) 606 .addClass("active current"); 607 form 608 .find(".cf7mls_progress_bar li") 609 .eq(cur) 610 .removeClass("active current"); 611 612 cf7mls_icon_check(form,'back'); 613 cf7mls_step_item_finish(pre, cur, form, 'back'); 614 } 615 } 616 617 // Progress Bar in ipad and mobie phone 618 if(form.find(".cf7mls_number_step_wrap").length) { 619 cf7mls_bar_process(form); 620 } 621 622 cf7mls_transition_effects(form, 'effects_back'); 623 624 dhScrollTo(form); 625 return false; 626 }); 627 628 629 /* 630 * Preview Form Clicked 631 */ 632 $(document).on("click", ".cf7mls_close_preview", function (event) { 633 event.preventDefault(); 634 var $this = $(this); 635 var form = $this.closest("form.wpcf7-form"); 636 form.css('padding-top', '0px'); 637 form.find("ul.cf7mls_progress_bar").css('display', 'flex'); 638 form.find( ".cf7mls_close_preview" ).remove(); 639 form.css('overflow', ''); 640 // form.find(".fieldset-cf7mls").css({ 641 // height: "", 642 // overflow: "", 643 // opacity: "", 644 // visibility: "" 645 // }); 646 647 form.find(".cf7mls_back").css('display', ''); 648 form.find(".cf7mls_next").css('display', ''); 649 form.find(".wpcf7-cf7mls_preview_step").css('display', ''); 650 651 form.find('.fieldset-cf7mls').removeClass('cf7mls_preview_fs'); 652 653 form.find("input").removeAttr("disabled"); 654 form.find("button").removeAttr("disabled"); 655 form.find("select").removeAttr("disabled"); 656 form.find("textarea").removeAttr("disabled"); 657 658 form.removeClass("cf7mls_reviewing"); 659 $("body") 660 .find(".cf7mls_reviewing_overlay") 661 .remove(); 662 preview_clicked = !preview_clicked; 663 }); 664 665 $(document).on("click", ".wpcf7-cf7mls_preview_step", function (event) { 666 event.preventDefault(); 667 var $this = $(this); 668 var form = $this.closest("form.wpcf7-form"); 669 670 if (preview_clicked === false) { 671 form.append("<div class=\"cf7mls_close_preview\"><span><i><svg viewBox=\"64 64 896 896\" data-icon=\"close\" width=\"1em\" height=\"1em\" fill=\"rgba(0, 0, 0, 0.45)\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z\"></path></svg></i></span></div>"); 672 form.css('padding-top', '20px'); 673 form.find("ul.cf7mls_progress_bar").css('display', 'none'); 674 675 form.find(".cf7mls_back").css('display', 'none'); 676 form.find(".cf7mls_next").css('display', 'none'); 677 form.find(".wpcf7-cf7mls_preview_step").css('display', 'none'); 678 679 form.css('overflow', 'inherit'); 680 // form.find(".fieldset-cf7mls").css({ 681 // height: "auto", 682 // overflow: "visible", 683 // opacity: "1", 684 // visibility: "visible" 685 // }); 686 form.find("input").attr("disabled", "disabled"); 687 form.find("button").attr("disabled", "disabled"); 688 form.find("select").attr("disabled", "disabled"); 689 form.find("textarea").attr("disabled", "disabled"); 690 form.find(".wpcf7-cf7mls_preview_step").removeAttr("disabled"); 691 692 form.addClass("cf7mls_reviewing"); 693 $("body").append('<div class="cf7mls_reviewing_overlay"></div>'); 694 form.find('.fieldset-cf7mls').addClass('cf7mls_preview_fs'); 695 } else { 696 form.css('padding-top', '0px'); 697 form.find("ul.cf7mls_progress_bar").css('display', 'flex'); 698 form.find( ".cf7mls_close_preview" ).remove(); 699 form.css('overflow', ''); 700 // form.find(".fieldset-cf7mls").css({ 701 // height: "", 702 // overflow: "", 703 // opacity: "", 704 // visibility: "" 705 // }); 706 707 form.find(".cf7mls_back").css('display', ''); 708 form.find(".cf7mls_next").css('display', ''); 709 form.find(".wpcf7-cf7mls_preview_step").css('display', ''); 710 711 form.find('.fieldset-cf7mls').removeClass('cf7mls_preview_fs'); 712 713 form.find("input").removeAttr("disabled"); 714 form.find("button").removeAttr("disabled"); 715 form.find("select").removeAttr("disabled"); 716 form.find("textarea").removeAttr("disabled"); 717 718 form.removeClass("cf7mls_reviewing"); 719 $("body") 720 .find(".cf7mls_reviewing_overlay") 721 .remove(); 722 } 723 724 preview_clicked = !preview_clicked; 725 }); 726 727 $(document).on("click", ".cf7mls-auto-next-step", function (event) { 728 var $this = $(this); 729 if($this.is("input")) { 730 $(document).on("change", $this, function (event) { 731 var currentFieldSet = $this.parent().closest("fieldset.f
731ieldset-cf7mls"); 732 $(currentFieldSet).find( ".cf7mls_next" ).trigger('click'); 733 }); 734 }else { 735 var currentFieldSet = $this.parent().closest("fieldset.fieldset-cf7mls"); 736 $(currentFieldSet).find( ".cf7mls_next" ).trigger('click'); 737 } 738 739 }); 740 741 // Allow Choose Step 742 $("form.wpcf7-form").each(function (index, el) { 743 let style_bar = $(el).find('.cf7mls_progress_bar').attr('data-bg-style-bar'); 744 if(style_bar !== undefined) { 745 let step = ''; 746 if(style_bar == 'box_vertical_squaren' || 747 style_bar == 'box_larerSign_squaren' 748 ) { 749 step = $('.cf7mls_progress_bar li'); 750 step_click = '.cf7mls_progress_bar li'; 751 }else { 752 step = $('.cf7mls_progress_bar li .cf7_mls_steps_item_icon, .cf7mls_progress_bar li .cf7_mls_steps_item_content'); 753 step_click = '.cf7mls_progress_bar li .cf7_mls_steps_item_icon, .cf7mls_progress_bar li .cf7_mls_steps_item_content'; 754 } 755 } 756 }); 757 758 $(document).on("click", step_click, function (event) { 759 var allow_choose_step = $(this).parents('.cf7mls_progress_bar').attr('data-allow-choose-step'); 760 let style_bar = $(this).parents('.cf7mls_progress_bar').attr('data-bg-style-bar'); 761 if(allow_choose_step === 'on') { 762 var form = $(this).parents("form.wpcf7-form"); 763 form.find('.wpcf7-response-output').css('display', ''); 764 // form.find('.wpcf7-response-output').text(''); 765 let step_action = ''; 766 767 if(style_bar == 'box_vertical_squaren' || 768 style_bar == 'box_larerSign_squaren' 769 ) { 770 step_action = Number($(this).attr('data-counter')) - 1; 771 $( "form .cf7mls_progress_bar li.cf7_mls_steps_item" ).each(function( index ) { 772 $(this).removeClass('choose-step'); 773 if($(this).hasClass('active') && $(this).hasClass('current') && !$(this).hasClass('cf7mls-steps-item-finish')) { 774 $(this).removeClass('active'); 775 $(this).removeClass('current'); 776 $(this).addClass('choose-step'); 777 } 778 }); 779 if(!$(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(step_action+1)+"]")).hasClass('cf7mls-steps-item-finish')) { 780 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(step_action+1)+"]")).addClass('active'); 781 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(step_action+1)+"]")).addClass('current'); 782 } 783 } else { 784 step_action = Number($(this).parents('li').attr('data-counter')) - 1; 785 $( "form .cf7mls_progress_bar li.cf7_mls_steps_item" ).each(function( index ) { 786 $(this).removeClass('choose-step'); 787 if($(this).hasClass('active') && $(this).hasClass('current') && !$(this).hasClass('cf7mls-steps-item-finish')) { 788 $(this).removeClass('active'); 789 $(this).removeClass('current'); 790 $(this).addClass('choose-step'); 791 if($(this).next().hasClass('cf7mls-steps-item-finish')) { 792 $(this).addClass('active'); 793 } 794 } 795 else if($(this).hasClass('active') && $(this).hasClass('current') && $(this).hasClass('cf7mls-steps-item-finish')) { 796 if(style_bar == 'horizontal_round' || style_bar == 'horizontal_squaren') { 797 if( !$(this).next().hasClass('cf7mls-steps-item-finish') ){ 798 $(this).removeClass('active'); 799 } 800 } else { 801 if( !$(this).hasClass('cf7mls-steps-item-finish') ){ 802 $(this).removeClass('active'); 803 } 804 } 805 806 $(this).addClass('choose-step'); 807 $(this).removeClass('current'); 808 // $(this).removeClass('cf7mls-steps-item-finish'); 809 } 810 }); 811 if(!$(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+step_action+"]")).next().hasClass('cf7mls-steps-item-finish')) { 812 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(step_action+1)+"]")).addClass('active'); 813 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(step_action+1)+"]")).addClass('current'); 814 } else { 815 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(step_action+1)+"]")).addClass('active'); 816 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(step_action+1)+"]")).addClass('current'); 817 } 818 } 819 820 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).removeClass('cf7mls-choose-step'); 821 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').removeClass('cf7mls_back_fs'); 822 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').removeClass('cf7mls_current_fs'); 823 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').removeClass('cf7mls-choose-step'); 824 825 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').css({display: 'none'}); 826 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).addClass('cf7mls_current_fs'); 827 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).addClass('cf7mls-choose-step'); 828 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).css({display: ''}); 829 // console.log(step_action); 830 cf7mls_transition_effects(form,'effects_next'); 831 } 832 }); 833 834 $(document).on("wpcf7mailsent", ".wpcf7-form.cf7mls-auto-return-first-step", function (event) { 835 const current_form = $(this);
836 current_form.find(".fieldset-cf7mls-wrapper fieldset.fieldset-cf7mls").each(function(index) { 837 if($(this).hasClass('choose-step')) { 838 $(this).removeClass('choose-step'); 839 } 840 if($(this).hasClass('cf7_mls_step_invalid')) { 841 $(this).removeClass('cf7_mls_step_invalid'); 842 } 843 if($(this).hasClass('cf7mls-steps-item-finish')) { 844 $(this).removeClass('cf7mls-steps-item-finish'); 845 } 846 if(index != 0) { 847 if($(this).hasClass('active')) { 848 $(this).removeClass('active'); 849 } 850 if($(this).hasClass('current')) { 851 $(this).removeClass('current'); 852 } 853 } else { 854 if(!$(this).hasClass('active')) { 855 $(this).addClass('active'); 856 } 857 if(!$(this).hasClass('current')) { 858 $(this).addClass('current'); 859 } 860 } 861 }); 862 863 current_form.find(".fieldset-cf7mls-wrapper fieldset.fieldset-cf7mls" ).each(function( index ) { 864 if(index === 0) { 865 $(this).css('display', 'block'); 866 } else { 867 if (index === $( "form .fieldset-cf7mls-wrapper fieldset.fieldset-cf7mls").length -1) { 868 $(this).css('display', 'none'); 869 } 870 } 871 872 if($(this).hasClass('cf7mls-choose-step')) { 873 $(this).removeClass('cf7mls-choose-step'); 874 } 875 if($(this).hasClass('cf7mls_back_fs')) { 876 $(this).removeClass('cf7mls_back_fs'); 877 } 878 879 if(index != 0) { 880 if($(this).hasClass('cf7mls_current_fs')) { 881 $(this).removeClass('cf7mls_current_fs'); 882 } 883 } else { 884 if(!$(this).hasClass('cf7mls_current_fs')) { 885 $(this).addClass('cf7mls_current_fs'); 886 } 887 } 888 }); 889 cf7mls_reset_icon(current_form); 890 }); 891 892 $(document).on("wpcf7invalid", ".wpcf7-form", function (event) { 893 const form = $(this); 894 setTimeout(() => { 895 $(this).find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").each(function (index) { 896 if($(this).find(".wpcf7-not-valid-tip").length > 0) { 897 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(index+1)+"]")).addClass('cf7_mls_step_invalid'); 898 } else { 899 if($(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(index+1)+"]")).hasClass('cf7_mls_step_invalid')) { 900 $(form.find(".cf7mls_progress_bar li.cf7_mls_steps_item[data-counter="+(index+1)+"]")).removeClass('cf7_mls_step_invalid'); 901 } 902 } 903 }); 904 }, 1000); 905 906 }); 907 908 function dhScrollTo(el) { 909 if (el.find(".fieldset-cf7mls-wrapper.no-scroll").length || el.hasClass('cf7mls-no-scroll')) { 910 return; 911 } 912 if (cf7mls_object.scroll_step == "true") { 913 $("html, body").animate({ 914 scrollTop: el.offset().top - 110 915 }, 916 "slow" 917 ); 918 } else if (cf7mls_object.scroll_step == "scroll_to_top") { 919 $("html, body").animate({ 920 scrollTop: $("body").offset().top - 110 921 }, 922 "slow" 923 ); 924 } 925 } 926 927 function cf7mls_toggle_next_btn(acceptances, fieldset) { 928 if (acceptances.length > 0) { 929 var ii = 0; 930 $.each(acceptances, function (i, v) { 931 if ($(v).is(":checked")) { 932 //console.log('checked'); 933 } else { 934 ii++; 935 } 936 }); 937 if (ii > 0) { 938 //console.log(ii); 939 $(fieldset) 940 .find(".cf7mls_next") 941 .attr("disabled", "disabled"); 942 } else { 943 $(fieldset) 944 .find(".cf7mls_next") 945 .removeAttr("disabled"); 946 } 947 } 948 } 949 950 // show, hide icon check 951 function cf7mls_icon_check(form,event) { 952 if(event == 'next') { 953 $(form).find('.cf7mls_progress_bar li').each(function(key, el) { 954 if(($(el).hasClass('active')) && !($(el).hasClass('current'))) { 955 if(!$(el).hasClass('cf7_mls_step_invalid')) { 956 $($(el).find('.cf7_mls_count_step')).css('display', 'none'); 957 } 958 $($(el).find('.cf7_mls_check')).css('display', 'block'); 959 } 960 }) 961 } 962 963 if(event == 'back') { 964 $(form).find('.cf7mls_progress_bar li').each(function(key, el) { 965 if(!($(el).hasClass('active')) || ($(el).hasClass('current'))) {
966 if(!$(el).hasClass('cf7_mls_step_invalid')) { 967 $($(el).find('.cf7_mls_count_step')).css('display', 'block'); 968 } 969 $($(el).find('.cf7_mls_check')).css('display', 'none'); 970 } 971 }) 972 } 973 } 974 975 function cf7mls_reset_icon(form) { 976 $(form).find('.cf7mls_progress_bar li').each(function(key, el) { 977 if(key ===0) { 978 $(el).attr('class', "cf7_mls_steps_item active current"); 979 } else { 980 $(el).attr('class', "cf7_mls_steps_item"); 981 } 982 $($(el).find('.cf7_mls_count_step')).css('display', 'block'); 983 $($(el).find('.cf7_mls_check')).css('display', 'none'); 984 }) 985 } 986 987 // add, remove class step item finish 988 function cf7mls_step_item_finish (cur, nex, form, event) { 989 let style_text = form.find('.cf7mls_progress_bar').attr('data-style-text'); 990 let style_bar = form.find('.cf7mls_progress_bar').attr('data-bg-style-bar'); 991 /* 992 note: cur start form 0, nex start form 1. 993 */ 994 let numberItem; 995 if(style_text == 'horizontal' || style_text == 'no') { 996 if((style_bar == 'navigation_horizontal_squaren') || 997 (style_bar == 'navigation_horizontal_round') || 998 (style_bar == 'largerSign_squaren') || 999 (style_bar == 'largerSign_round') 1000 ) { 1001 numberItem = cur; 1002 } 1003 } 1004 1005 if(style_text == 'vertical') { 1006 if((style_bar == 'navigation_horizontal_squaren') || 1007 (style_bar == 'navigation_horizontal_round') || 1008 (style_bar == 'largerSign_squaren') || 1009 (style_bar == 'largerSign_round') 1010 ) { 1011 numberItem = nex; 1012 } 1013 } 1014 1015 if((style_bar == 'box_vertical_squaren') || 1016 (style_bar == 'box_larerSign_squaren')) 1017 { 1018 numberItem = cur; 1019 } 1020 1021 if((style_bar == 'horizontal_round') || 1022 (style_bar == 'horizontal_squaren') 1023 ) { 1024 numberItem = nex; 1025 } 1026 1027 if(numberItem || numberItem == '0') { 1028 if(event == 'next') { 1029 form 1030 .find(".cf7mls_progress_bar li") 1031 .eq(numberItem) 1032 .addClass("cf7mls-steps-item-finish"); 1033 }else if(event == 'back') { 1034 form 1035 .find(".cf7mls_progress_bar li") 1036 .eq(numberItem) 1037 .removeClass("cf7mls-steps-item-finish"); 1038 } 1039 1040 } 1041 if(form 1042 .find(".cf7mls_progress_bar li") 1043 .eq(cur).hasClass('cf7_mls_step_invalid')) { 1044 form 1045 .find(".cf7mls_progress_bar li") 1046 .eq(cur).removeClass('cf7_mls_step_invalid'); 1047 } 1048 } 1049 1050 function cf7mls_color_bar(color, id_form, el) { 1051 let style_bar = 'cf7mls_bar_style_' + $(el).find('.cf7mls_progress_bar').attr('data-bg-style-bar'); 1052 let style_text = 'cf7mls_bar_style_text_' + $(el).find('.cf7mls_progress_bar').attr('data-style-text'); 1053 1054 let css_item_icon = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7_mls_steps_item_icon { background: '+ color + ';}'; 1055 let css_item_icon_befor = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active:before { background: '+ color + ';}'; 1056 let css_bg_li = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active{ background: '+ color + ';}'; 1057 let css_step = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7_mls_count_step{ color: '+ color + ';}' 1058 let css_check = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7_mls_check{ color: '+ color + ';}'; 1059 let css_li_after = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active:after{background: '+ color + ';}'; 1060 let css_box_li_after = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active:after{background: #eaedef;}'; 1061 let css_box_li_finish_after = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.cf7mls-steps-item-finish + li:after{background:'+ color + ';}'; 1062 let css_box_li_before_finish_after = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active + li.cf7mls-steps-item-finish:after{background:'+ color + ';}'; 1063 let css_active_title = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7mls_progress_bar_title{color: #fff;}'; 1064 let classItemFinsish = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.cf7mls-steps-item-finish'; 1065 let classCurrent = '.' + style_bar + '.' + style_text + ' li.current'; 1066 let css_title_after = '.cf7mls_progress_bar_title:after{background: '+ color + ';}'; 1067 let css_title_border = '.cf7mls_progress_bar_title:after{border-color: '+ color + ';}'; 1068 let css_li_cur = '.' + style_bar + '.' + style_text + ' li.current + li:after{ background: '+ color + ';}'; 1069 1070 let css_progress_bar = ''; 1071 // progress bar on computer 1072 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 1073 (style_bar == 'cf7mls_bar_style_largerSign_squaren') || 1074 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') || 1075 (style_bar == 'cf7mls_bar_style_largerSign_round') 1076 ) { 1077 switch (style_text) { 1078 case 'cf7mls_bar_style_text_horizontal': 1079 css_progress_bar += css_item_icon; 1080 1081 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 1082 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') 1083 ) { 1084 css_progress_bar += classItemFinsish + ' ' + css_title_after; 1085 } 1086 1087 if((style_bar == 'cf7mls_bar_style_largerSign_squaren') || 1088 (style_bar == 'cf7mls_bar_style_largerSign_round') 1089 ) { 1090 css_progress_bar += classItemFinsish + ' ' + '.cf7_mls_arrow_point_to_righ svg {fill: '+ color + ';}'; 1091 } 1092 1093 break; 1094
1095 case 'cf7mls_bar_style_text_vertical': 1096 css_progress_bar += css_item_icon_befor; 1097 1098 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 1099 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') 1100 ) { 1101 css_progress_bar += classItemFinsish + ':after{ background: '+ color + ';}'; 1102 } 1103 1104 if((style_bar == 'cf7mls_bar_style_largerSign_squaren') || 1105 (style_bar == 'cf7mls_bar_style_largerSign_round') 1106 ) { 1107 css_progress_bar += classItemFinsish + ':after{ border-color: '+ color + ';}'; 1108 } 1109 1110 break; 1111 1112 case 'cf7mls_bar_style_text_no': 1113 css_progress_bar += css_item_icon; 1114 1115 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 1116 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') 1117 ) { 1118 css_progress_bar += classItemFinsish + ' ' + css_title_after; 1119 } 1120 1121 if((style_bar == 'cf7mls_bar_style_largerSign_squaren') || 1122 (style_bar == 'cf7mls_bar_style_largerSign_round') 1123 ) { 1124 css_progress_bar += classItemFinsish + ' ' + css_title_border; 1125 } 1126 break; 1127 } 1128 } 1129 1130 if((style_bar == 'cf7mls_bar_style_horizontal_squaren') || 1131 (style_bar == 'cf7mls_bar_style_horizontal_round') 1132 ) { 1133 if(style_text == 'cf7mls_bar_style_text_horizontal') { 1134 css_progress_bar += css_item_icon; 1135 css_progress_bar += classCurrent + ':before {background-color:' + color + '}'; 1136 } 1137 1138 if((style_text == 'cf7mls_bar_style_text_vertical') || 1139 (style_text == 'cf7mls_bar_style_text_no')) { 1140 css_progress_bar += css_item_icon_befor; 1141 css_progress_bar += classCurrent + ':after {background-color:' + color + '}'; 1142 } 1143 } 1144 1145 if(((style_bar == 'cf7mls_bar_style_box_vertical_squaren') || 1146 (style_bar == 'cf7mls_bar_style_box_larerSign_squaren')) && 1147 (style_text) 1148 ) { 1149 css_progress_bar += css_bg_li; 1150 css_progress_bar += css_step; 1151 css_progress_bar += css_check; 1152 css_progress_bar += css_li_after; 1153 css_progress_bar += css_active_title; 1154 } 1155 1156 if(style_bar == 'cf7mls_bar_style_box_larerSign_squaren') { 1157 css_progress_bar += css_li_cur; 1158 css_progress_bar += css_box_li_after; 1159 css_progress_bar += css_box_li_finish_after; 1160 css_progress_bar += css_box_li_before_finish_after; 1161 } 1162 1163 $('style#cf7mls_style_progress_bar_' + id_form).text(css_progress_bar); 1164 } 1165 1166 // progress bar in ipad and mobie phone 1167 function cf7mls_bar_process(form) { 1168 let number_step_cur = form.find('.cf7mls_progress_bar li.current').attr('data-counter'); 1169 let number_step = form.find('.cf7mls_number_step_wrap').attr('data-number-step'); 1170 let bg_color = form.find('.cf7mls_number_step_wrap').attr('data-bg-color'); 1171 if(number_step_cur && number_step) { 1172 form.find('.cf7mls_number_step_wrap .cf7mls_number').text(number_step_cur + '/' + number_step); 1173 let title = $(form.find('.cf7mls_progress_bar li')[Number(number_step_cur) - 1]).find('.cf7mls_progress_bar_title').text(); 1174 form.find('.cf7mls_number_step_wrap .cf7mls_step_current').text(title); 1175 let percent_step = 100 / (Number(number_step) - 1); 1176 if(number_step_cur == '1') { 1177 form.find('.cf7mls_number_step_wrap .cf7mls_progress_barinner').css('width', ''); 1178 }else { 1179 form.find('.cf7mls_number_step_wrap .cf7mls_progress_barinner').css('width', ((percent_step * (Number(number_step_cur) - 1)) + '%')); 1180 } 1181 } 1182 1183 if(bg_color) { 1184 form.find('.cf7mls_number_step_wrap .cf7mls_progress_barinner').css('background', bg_color); 1185 } 1186 } 1187 1188 function cf7mls_transition_effects(form, transitions_bt) { 1189 var transition_effects = $(form).find(".fieldset-cf7mls-wrapper").attr("data-transition-effects"); 1190 if(transition_effects && typeof transition_effects !== undefined) { 1191 var effects = transition_effects.split(" "); 1192 var effect_form = { 1193 transition_effects: transition_effects, 1194 effects_back: '', 1195 effects_next: '', 1196 effects_in: '' 1197 }; 1198 1199 $.each(effects, function(index, effect){ 1200 var es = effect.split("_"); 1201 1202 switch(es[0]) { 1203 case 'back': 1204 effect_form.effects_back = es[1]; 1205 break; 1206 case 'next': 1207 effect_form.effects_next = es[1]; 1208 break; 1209 case 'in': 1210 effect_form.effects_in = es[1]; 1211 break; 1212 } 1213 }) 1214 1215 if(transitions_bt == 'effects_in') { 1216 $(form).find('.fieldset-cf7mls-wrapper .cf7mls_current_fs').addClass(effect_form.effects_in + ' ' +"animated"); 1217 }else if(form.find(".fieldset-cf7mls-wrapper").length && transitions_bt) { 1218 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass(effect_form.effects_back); 1219 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass(effect_form.effects_next); 1220 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass(effect_form.effects_in); 1221 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass('animated'); 1222 form.find(".fieldset-cf7mls-wrapper .cf7mls_current_fs").addClass(effect_form[transitions_bt] + ' ' + "animated"); 1223 } 1224 } 1225 } 1226 1227 function getFormattedDate(date) { 1228 let year = date.getFullYear(); 1229 let month = (1 + date.getMonth()).toString().padStart(2, '0'); 1230 let day = date.getDate().toString().padStart(2, '0'); 1231 1232 return day + '.' + month + '.' + year; 1233 } 1234 1235 }); 1236 1237 1238 1239 1240 //jQuery(window).on("load", function () { 1241 // jQuery.each(jQuery('form.wpcf7-form'), function(index, el) { 1242 // var bar_li = jQuery('.cf7mls_progress_bar li', jQuery(el)); 1243 // bar_li.css({ 1244 // 'width' : "calc(100% / " + bar_li.length + ")" 1245 // }); 1246 // var le = jQuery('.cf7mls_progress_bar li', jQuery(el)).length; 1247 // jQuery.each(jQuery('.cf7mls_progress_bar li', jQuery(el)), function(index, el) { 1248 // jQuery(el).attr('data-counter', index + 1); 1249 // jQuery(el).attr('data-counter_rtl', le); 1250 // le--; 1251 // }); 1252 // }); 1253 //}); 1254 1255})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.