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 9 jQuery(document).ready(function ($) { 10 11 // Transition effects 12 $("form.wpcf7-form").each(function (index, el) { 13 cf7mls_transition_effects(el, 'effects_in'); 14 }); 15 16 $("form.wpcf7-form").each(function (index, el) { 17 var totalFieldset = 0; 18 var this_form = $(el); 19 var findFieldset = $(el).find("fieldset.fieldset-cf7mls"); 20 if (findFieldset.length > 0) { 21 this_form.addClass('cf7mls') 22 $.each(findFieldset, function (i2, el2) { 23 if (i2 == 0) { 24 $(el2).addClass("cf7mls_current_fs"); 25 } 26 27 jQuery(el2).attr("data-cf7mls-order", i2); 28 totalFieldset = totalFieldset + 1; 29 //disable next button if the fieldset has wpcf7-acceptance 30 var acceptances = jQuery(el2).find("input:checkbox.wpcf7-acceptance"); 31 if (acceptances.length) { 32 cf7mls_toggle_next_btn(acceptances, el2); 33 } 34 }); 35 $.each(findFieldset, function (i2, el2) { 36 if (i2 == totalFieldset - 1) { 37 $(el2) 38 .find(".cf7mls_next") 39 .remove(); 40 } 41 }); 42 $(el).attr("data-count-fieldset", totalFieldset); 43 //on form submit 44 if (cf7mls_object.disable_enter_key) { 45 $(el) 46 .find('[type="submit"]') 47 .click(function (event) { 48 var findFieldset = $(el).find( 49 "fieldset.fieldset-cf7mls.cf7mls_current_fs" 50 ); 51 if (findFieldset.data("cf7mls-order") != totalFieldset - 1) { 52 findFieldset.find(".cf7mls_next").click(); 53 return false; 54 } 55 }); 56 } else { 57 $(el).submit(function (event) { 58 var findFieldset = $(el).find( 59 "fieldset.fieldset-cf7mls.cf7mls_current_fs" 60 ); 61 if (findFieldset.data("cf7mls-order") != totalFieldset - 1) { 62 findFieldset.find(".cf7mls_next").click(); 63 return false; 64 } 65 }); 66 } 67 } 68 //answer fields 69 $(el) 70 .find("input.wpcf7-cf7_answer") 71 .each(function (njt_a_i, njt_a_e) { 72 var $this = $(njt_a_e); 73 var qf = this_form.find('[name="' + $this.data("qf") + '"]'); 74 var sp = $("span.wpcf7-cf7_answer_" + $this.data("qf")); 75 var arrChecked = []; 76 var isCheckbox = 77 $this.data("qf").indexOf("cbmls") >= 0 ? true : false; 78 79 if (isCheckbox) { 80 qf = this_form.find('[name="' + $this.data("qf") + "[]" + '"]'); 81 qf.on("change", function (event) { 82 event.preventDefault(); 83 var _val = $(this).val(); 84 var arrCheckedIndex = $.inArray(_val, arrChecked); 85 if (this.checked) { 86 if (arrCheckedIndex === -1) arrChecked.push(_val); 87 } else { 88 arrChecked.splice(arrCheckedIndex, 1); 89 } 90 sp.text(arrChecked.toString()); 91 $this.val(arrChecked.toString()); 92 }); 93 } else { 94 if (qf.val()) { 95 var _val = qf.val(); 96 sp.text(_val); 97 $this.val(_val); 98 wpcf7.triggerEvent( sp, 'cf7mls_af', { sp: sp, ip: $this, qf: qf, text: _val} ); 99 } 100 qf.on("change", function (event) { 101 event.preventDefault(); 102 var _val = $(this).val(); 103 sp.text(_val); 104 $this.val(_val); 105 wpcf7.triggerEvent( sp, 'cf7mls_af', { sp: sp, ip: $this, qf: qf, text: _val} ); 106 }); 107 } 108 }); 109 }); 110 111 // Background Color Progress Bar 112 $("form.wpcf7-form").each(function (index, el) { 113 let id_form = $(el).find('.cf7mls_progress_bar').attr('data-id-form'); 114 var progress_bar_bg_color = $(el).find('.cf7mls_progress_bar').attr('data-bg-color'); 115 $('head').append('<style id="cf7mls_style_progress_bar_' + id_form + '" type="text/css"></style>'); 116 if(progress_bar_bg_color && id_form) { 117 cf7mls_color_bar(progress_bar_bg_color, id_form, el); 118 } 119 });
120 121 jQuery(document).on( 122 "click", 123 "form.wpcf7-form input:checkbox.wpcf7-acceptance", 124 function (event) { 125 //event.preventDefault(); 126 var $this = jQuery(this); 127 var parent_fieldset = $this.closest("fieldset.fieldset-cf7mls"); 128 if (parent_fieldset.length) { 129 var acceptances = jQuery(parent_fieldset).find( 130 "input:checkbox.wpcf7-acceptance" 131 ); 132 if (acceptances.length) { 133 cf7mls_toggle_next_btn(acceptances, parent_fieldset); 134 } 135 } 136 } 137 ); 138 139 $(document).on("click", ".cf7mls_next", function (event) { 140 event.preventDefault(); 141 var $this = $(this); 142 $this.addClass("sending"); 143 current_fs = $this.closest(".fieldset-cf7mls"); 144 next_fs = current_fs.next(); 145 146 //validation 147 var form = $this.parent().closest("form.wpcf7-form"); 148 149 var fd = new FormData(); 150 $.each(form.find('input[type="file"]'), function (index, el) { 151 fd.append($(el).attr("name"), $(el)[0].files[0]); 152 }); 153 154 var other_data = form.serializeArray(); 155 $.each(other_data, function (key, input) { 156 fd.append(input.name, input.value); 157 }); 158 159 $.ajax({
160 url: cf7mls_object.ajax_url + "?action=cf7mls_validation", 161 type: "POST", 162 data: fd, 163 processData: false, 164 contentType: false 165 }) 166 .done(function (msg) { 167 $this.removeClass("sending"); 168 var json = $.parseJSON(msg); 169 170 /* 171 * Insert _form_data_id if 'json variable' has 172 */ 173 if (typeof json._cf7mls_db_form_data_id != "undefined") { 174 if (!form.find('input[name="_cf7mls_db_form_data_id"]').length) { 175 form.append( 176 '<input type="hidden" name="_cf7mls_db_form_data_id" value="' + 177 json._cf7mls_db_form_data_id + 178 '" />' 179 ); 180 } 181 } 182 183 if (!json.success) { 184 var checkError = 0; 185 //reset error messages 186 current_fs 187 .find(".wpcf7-form-control-wrap") 188 .removeClass("cf7mls-invalid"); 189 current_fs.find(".cf7mls-invalid").removeClass("cf7mls-invalid"); 190 191 current_fs 192 .find(".wpcf7-form-control-wrap .wpcf7-not-valid-tip") 193 .remove(); 194 195 current_fs 196 .find(".wpcf7-form-control-wrap .wpcf7-not-valid") 197 .removeClass("wpcf7-not-valid"); 198 199 if (has_response) { 200 current_fs 201 .find(".wpcf7-response-output.wpcf7-validation-errors") 202 .removeClass("wpcf7-validation-errors"); 203 } else { 204 current_fs 205 .find(".wpcf7-response-output.wpcf7-validation-errors") 206 .remove(); 207 } 208 209 $.each(json.invalid_fields, function (index, el) { 210 if ( 211 current_fs.find('input[name="' + index + '"]').length || 212 current_fs.find('input[name="' + index + '[]"]').length || 213 current_fs.find('select[name="' + index + '"]').length || 214 current_fs.find('select[name="' + index + '[]"]').length || 215 current_fs.find('textarea[name="' + index + '"]').length || 216 current_fs.find('textarea[name="' + index + '[]"]').length || 217 current_fs.find('input[data-name="' + index + '"]').length || 218 current_fs.find('input[data-name="' + index + '[]"]').length 219 ) { 220 checkError = checkError + 1; 221 222 //var controlWrap = $('.wpcf7-form-control-wrap.' + index, form); 223 var controlWraps = [ 224 $('[name="' + index + '"]', form).parent(), 225 $('[name="' + index + '[]"]', form).parent(), 226 $('[data-name="' + index + '"]', form).parent(), 227 $('[data-name="' + index + '[]"]', form).parent() 228 ]; 229 $.each(controlWraps, function (i1, e1) { 230 var _c = "wpcf7-not-valid-tip"; 231 if (e1.hasClass("form-group")) { 232 e1.addClass("has-error"); 233 _c += " help-block"; 234 } 235 e1.addClass("cf7mls-invalid"); 236 e1.find("span.wpcf7-not-valid-tip").remove(); 237 e1.find(".wpcf7-validates-as-required").addClass( 238 "wpcf7-not-valid" 239 ); 240 if (e1.parents(".wpcf7-checkbox").length) { 241 e1.parents(".wpcf7-checkbox").after( 242 '<span role="alert" class="' + 243 _c + 244 '">' + 245 el.reason + 246 "</span>" 247 ); 248 } else if (e1.parents(".wpcf7-radio").length) { 249 e1.parents(".wpcf7-radio").after( 250 '<span role="alert" class="' + 251 _c + 252 '">' + 253 el.reason + 254 "</span>" 255 ); 256 } else { 257 e1.append( 258 '<span role="alert" class="' + 259 _c + 260 '">' + 261 el.reason + 262 "</span>" 263 ); 264 } 265 }); 266 267 //return false; 268 } 269 }); 270 271 if (checkError == 0) { 272 json.success = true; 273 has_response = false; 274 // jQuery("html, body").animate( 275 // { 276 // scrollTop: jQuery($this.closest("form")).offset().top - 110 277 // }, 278 // 1000 279 // ); 280 } else { 281 if (current_fs.find(".wpcf7-response-output").length) { 282 has_response = true; 283 284 $icon = ''; 285 $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">'; 286 $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"/>';
287 $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"/>'; 288 $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>'; 289 current_fs 290 .find(".wpcf7-response-output") 291 .addClass("wpcf7-validation-errors") 292 .show() 293 .html($icon + json.message); 294 } else { 295 has_response = false; 296 $icon = ''; 297 $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">'; 298 $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"/>'; 299 $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"/>'; 300 $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>'; 301 302 current_fs.append( 303 '<div class="wpcf7-response-output wpcf7-display-none wpcf7-validation-errors" style="display: block;" role="alert">' + $icon + 304 json.message + 305 "</div>" 306 307 308 ); 309 } 310 } 311 } 312 313 if (json.success) { 314 /* 315 current_fs.fadeOut('400', function() { 316 next_fs.fadeIn('400'); 317 }); 318 319 }); 320 */ 321 322 //reset error messages 323 current_fs 324 .find(".wpcf7-form-control-wrap") 325 .removeClass("cf7mls-invalid"); 326 current_fs.find(".cf7mls-invalid").removeClass("cf7mls-invalid"); 327 current_fs.find(".wpcf7-not-valid").removeClass("wpcf7-not-valid"); 328 current_fs 329 .find(".wpcf7-form-control-wrap .wpcf7-not-valid-tip") 330 .remove(); 331 332 /* 333 * Instead of hiding current fs, we hide all 334 */ 335 /* 336 current_fs.css({ 337 height: '0px', 338 overflow: 'hidden', 339 opacity: '0', 340 'visibility': 'hidden' 341 }).removeClass('cf7mls_current_fs'); 342 */ 343 344 form.find(".cf7mls_current_fs").addClass("cf7mls_back_fs"); 345 346 form.find(".fieldset-cf7mls").removeClass("cf7mls_current_fs"); 347 348 next_fs.addClass("cf7mls_current_fs"); 349 350 if (form.find(".cf7mls_progress_bar").length) { 351 let allow_choose_step = form.find('.cf7mls_progress_bar').attr('data-allow-choose-step'); 352 let order_cur = Number(form.find('fieldset.cf7mls-choose-step').attr('data-cf7mls-order')); 353 let step_cur = Number(form.find(".cf7mls_progress_bar li.current").attr('data-counter')) - 1; 354 355 // allow choose step 356 if(allow_choose_step === 'on') { 357 form.find('fieldset.fieldset-cf7mls').css({display: ''}); 358 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls-choose-step"); 359 } 360 361 if((allow_choose_step === 'on') && 362 ((order_cur !== step_cur) && ((order_cur === 0) || order_cur)) 363 ) { 364 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_back_fs");
365 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_current_fs"); 366 367 form.find('fieldset.fieldset-cf7mls').each(function( index, el ) { 368 if(index > step_cur) { 369 return; 370 } 371 $(el).addClass("cf7mls_back_fs"); 372 if(index === step_cur) { 373 $(el).removeClass("cf7mls_back_fs"); 374 $(el).addClass("cf7mls_current_fs"); 375 } 376 }); 377 }else { 378 var cur = form.find("fieldset.fieldset-cf7mls").index(current_fs); 379 var nex = form.find("fieldset.fieldset-cf7mls").index(next_fs); 380 if(cf7mls_object.is_rtl == '1') { 381 cur = 0 - cur 382 nex = 0 - nex 383 } 384 form 385 .find(".cf7mls_progress_bar li") 386 .eq(cur) 387 .removeClass("current"); 388 form 389 .find(".cf7mls_progress_bar li") 390 .eq(nex) 391 .addClass("active current"); 392 393 cf7mls_step_item_finish(cur, nex, form, 'next'); 394 cf7mls_icon_check('next'); 395 } 396 } 397 398 399 // Progress Bar in ipad and mobie phone 400 if(form.find(".cf7mls_number_step_wrap").length) { 401 cf7mls_bar_process(form); 402 } 403 404 cf7mls_transition_effects(form, 'effects_next'); 405 406 dhScrollTo(form); 407 return false; 408 } else {} 409 }) 410 .fail(function () { 411 $this.removeClass("sending"); 412 console.log("Validation error"); 413 }) 414 .always(function () { 415 $this.removeClass("sending"); 416 console.log("Validation complete"); 417 }); 418 419 return false; 420 }); 421 422 $(".cf7mls_back").click(function () { 423 var $this = $(this); 424 var form = $this.parent().closest("form.wpcf7-form"); 425 426 $(".wpcf7-response-output.wpcf7-display-none") 427 .removeClass("wpcf7-validation-errors") 428 .removeAttr("style") 429 .html(""); 430 $(".wpcf7-response-output.wpcf7-display-none.wpcf7-mail-sent-ok").hide(); 431 432 current_fs = $this.closest(".fieldset-cf7mls"); 433 previous_fs = current_fs.prev(); 434 435 //reset error messages 436 current_fs.find(".wpcf7-form-control-wrap").removeClass("cf7mls-invalid"); 437 current_fs.find(".cf7mls-invalid").removeClass("cf7mls-invalid"); 438 current_fs.find(".wpcf7-not-valid").removeClass("wpcf7-not-valid"); 439 current_fs.find(".wpcf7-form-control-wrap .wpcf7-not-valid-tip").remove(); 440 441 /* 442 * Instead of hide current fs, we hide all 443 */ 444 /*current_fs.css({ 445 height: '0px', 446 overflow: 'hidden', 447 opacity: '0', 448 'visibility': 'hidden' 449 }).removeClass('cf7mls_current_fs');*/ 450 form.find(".fieldset-cf7mls").removeClass("cf7mls_current_fs"); 451 452 previous_fs.addClass("cf7mls_current_fs").removeClass("cf7mls_back_fs"); 453 454 if (form.find(".cf7mls_progress_bar").length) { 455 form.find('fieldset.fieldset-cf7mls').css({display: ''}); 456 let allow_choose_step = form.find('.cf7mls_progress_bar').attr('data-allow-choose-step'); 457 let order_cur = Number(form.find('fieldset.cf7mls-choose-step').attr('data-cf7mls-order')); 458 let step_cur = Number(form.find(".cf7mls_progress_bar li.current").attr('data-counter')) - 1; 459 460 if((allow_choose_step === 'on') && 461 ((order_cur !== step_cur) && ((order_cur === 0) || order_cur)) 462 ) { 463 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_back_fs"); 464 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls_current_fs"); 465 form.find("fieldset.fieldset-cf7mls").removeClass("cf7mls-choose-step"); 466 467 form.find('fieldset.fieldset-cf7mls').each(function( index, el ) { 468 if(index > step_cur) { 469 return; 470 } 471 $(el).addClass("cf7mls_back_fs"); 472 if(index === step_cur) { 473 $(el).removeClass("cf7mls_back_fs"); 474 $(el).addClass("cf7mls_current_fs"); 475 } 476 }); 477 }else {
478 var pre = form.find("fieldset.fieldset-cf7mls").index(previous_fs) 479 var cur = form.find("fieldset.fieldset-cf7mls").index(current_fs) 480 if(cf7mls_object.is_rtl == '1') { 481 pre = 0 - pre 482 cur = 0 - cur 483 } 484 form 485 .find(".cf7mls_progress_bar li") 486 .eq(pre) 487 .addClass("current"); 488 form 489 .find(".cf7mls_progress_bar li") 490 .eq(cur) 491 .removeClass("active current"); 492 493 cf7mls_icon_check('back'); 494 cf7mls_step_item_finish(pre, cur, form, 'back'); 495 } 496 } 497 498 // Progress Bar in ipad and mobie phone 499 if(form.find(".cf7mls_number_step_wrap").length) { 500 cf7mls_bar_process(form); 501 } 502 503 cf7mls_transition_effects(form, 'effects_back'); 504 505 dhScrollTo(form); 506 return false; 507 }); 508 509 /* 510 * Preview Form Clicked 511 */ 512 $(document).on("click", ".wpcf7-cf7mls_preview_step", function (event) { 513 event.preventDefault(); 514 var $this = $(this); 515 var form = $this.closest("form.wpcf7-form"); 516 517 if (preview_clicked === false) { 518 form.find(".cf7mls_back").css('display', 'none'); 519 form.find(".cf7mls_next").css('display', 'none'); 520 521 form.css('overflow', 'inherit'); 522 // form.find(".fieldset-cf7mls").css({ 523 // height: "auto", 524 // overflow: "visible", 525 // opacity: "1", 526 // visibility: "visible" 527 // }); 528 form.find("input").attr("disabled", "disabled"); 529 form.find("button").attr("disabled", "disabled"); 530 form.find("select").attr("disabled", "disabled"); 531 form.find("textarea").attr("disabled", "disabled"); 532 form.find(".wpcf7-cf7mls_preview_step").removeAttr("disabled"); 533 534 form.addClass("cf7mls_reviewing"); 535 $("body").append('<div class="cf7mls_reviewing_overlay"></div>'); 536 form.find('.fieldset-cf7mls').addClass('cf7mls_preview_fs'); 537 } else { 538 form.css('overflow', ''); 539 // form.find(".fieldset-cf7mls").css({ 540 // height: "", 541 // overflow: "", 542 // opacity: "", 543 // visibility: "" 544 // }); 545 546 form.find(".cf7mls_back").css('display', ''); 547 form.find(".cf7mls_next").css('display', ''); 548 549 form.find('.fieldset-cf7mls').removeClass('cf7mls_preview_fs'); 550 551 form.find("input").removeAttr("disabled"); 552 form.find("button").removeAttr("disabled"); 553 form.find("select").removeAttr("disabled"); 554 form.find("textarea").removeAttr("disabled"); 555 556 form.removeClass("cf7mls_reviewing"); 557 $("body") 558 .find(".cf7mls_reviewing_overlay") 559 .remove(); 560 } 561 562 preview_clicked = !preview_clicked; 563 }); 564 }); 565 566 // Allow Choose Step 567 $("form.wpcf7-form").each(function (index, el) { 568 let style_bar = $(el).find('.cf7mls_progress_bar').attr('data-bg-style-bar'); 569 let step = ''; 570 if(style_bar == 'box_vertical_squaren' || 571 style_bar == 'box_larerSign_squaren' 572 ) { 573 step = $('.cf7mls_progress_bar li'); 574 }else { 575 step = $('.cf7mls_progress_bar li .cf7_mls_steps_item_icon'); 576 } 577 step.click(function() { 578 var allow_choose_step = $(this).parents('.cf7mls_progress_bar').attr('data-allow-choose-step'); 579 if(allow_choose_step === 'on') { 580 var form = $(this).parents("form.wpcf7-form"); 581 form.find('.wpcf7-response-output').css('display', ''); 582 form.find('.wpcf7-response-output').text(''); 583 let step_action = ''; 584 585 if(style_bar == 'box_vertical_squaren' || 586 style_bar == 'box_larerSign_squaren' 587 ) { 588 step_action = Number($(this).attr('data-counter')) - 1; 589 }else { 590 step_action = Number($(this).parents('li').attr('data-counter')) - 1; 591 } 592 593 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).removeClass('cf7mls-choose-step'); 594 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').removeClass('cf7mls_back_fs'); 595 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').removeClass('cf7mls_current_fs'); 596 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').removeClass('cf7mls-choose-step'); 597 598 form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls').css({display: 'none'}); 599 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).addClass('cf7mls_current_fs'); 600 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).addClass('cf7mls-choose-step'); 601 $(form.find('.fieldset-cf7mls-wrapper .fieldset-cf7mls')[step_action]).css({display: ''}); 602 } 603 }) 604 }); 605 606 //jQuery(window).on("load", function () { 607 // jQuery.each(jQuery('form.wpcf7-form'), function(index, el) { 608 // var bar_li = jQuery('.cf7mls_progress_bar li', jQuery(el)); 609 // bar_li.css({ 610 // 'width' : "calc(100% / " + bar_li.length + ")" 611 // }); 612 // var le = jQuery('.cf7mls_progress_bar li', jQuery(el)).length; 613 // jQuery.each(jQuery('.cf7mls_progress_bar li', jQuery(el)), function(index, el) { 614 // jQuery(el).attr('data-counter', index + 1); 615 // jQuery(el).attr('data-counter_rtl', le); 616 // le--; 617 // }); 618 // }); 619 //}); 620 621 function cf7mls_is_not_last_fieldset(fieldset, total_fieldset) { 622 var order = fieldset.data("cf7mls-order"); 623 return order != total_fieldset; 624 } 625 626 function dhScrollTo(el) { 627 if (el.find(".fieldset-cf7mls-wrapper.no-scroll").length || el.hasClass('cf7mls-no-scroll')) { 628 return; 629 } 630 if (cf7mls_object.scroll_step == "true") { 631 $("html, body").animate({ 632 scrollTop: el.offset().top - 110 633 }, 634 "slow" 635 ); 636 } else if (cf7mls_object.scroll_step == "scroll_to_top") { 637 $("html, body").animate({ 638 scrollTop: $("body").offset().top - 110 639 }, 640 "slow" 641 ); 642 } 643 } 644 645 function cf7mls_toggle_next_btn(acceptances, fieldset) { 646 if (acceptances.length > 0) { 647 var ii = 0; 648 jQuery.each(acceptances, function (i, v) { 649 if (jQuery(v).is(":checked")) { 650 //console.log('checked'); 651 } else { 652 ii++; 653 } 654 }); 655 if (ii > 0) { 656 //console.log(ii);
657 jQuery(fieldset) 658 .find(".cf7mls_next") 659 .attr("disabled", "disabled"); 660 } else { 661 jQuery(fieldset) 662 .find(".cf7mls_next") 663 .removeAttr("disabled"); 664 } 665 } 666 } 667 668 // show, hide icon check 669 function cf7mls_icon_check(event) { 670 if(event == 'next') { 671 $('.cf7mls_progress_bar li').each(function(key, el) { 672 if(($(el).hasClass('active')) && !($(el).hasClass('current'))) { 673 $($(el).find('.cf7_mls_count_step')).css('display', 'none'); 674 $($(el).find('.cf7_mls_check')).css('display', 'block'); 675 } 676 }) 677 } 678 679 if(event == 'back') { 680 $('.cf7mls_progress_bar li').each(function(key, el) { 681 if(!($(el).hasClass('active')) || ($(el).hasClass('current'))) { 682 $($(el).find('.cf7_mls_count_step')).css('display', 'block'); 683 $($(el).find('.cf7_mls_check')).css('display', 'none'); 684 } 685 }) 686 } 687 } 688 689 // add, remove class step item finish 690 function cf7mls_step_item_finish (cur, nex, form, event) { 691 let style_text = form.find('.cf7mls_progress_bar').attr('data-style-text'); 692 let style_bar = form.find('.cf7mls_progress_bar').attr('data-bg-style-bar'); 693 /* 694 note: cur start form 0, nex start form 1. 695 */ 696 let numberItem; 697 if(style_text == 'horizontal' || style_text == 'no') { 698 if((style_bar == 'navigation_horizontal_squaren') || 699 (style_bar == 'navigation_horizontal_round') || 700 (style_bar == 'largerSign_squaren') || 701 (style_bar == 'largerSign_round') 702 ) { 703 numberItem = cur; 704 } 705 } 706 707 if(style_text == 'vertical') { 708 if((style_bar == 'navigation_horizontal_squaren') || 709 (style_bar == 'navigation_horizontal_round') || 710 (style_bar == 'largerSign_squaren') || 711 (style_bar == 'largerSign_round') 712 ) { 713 numberItem = nex; 714 } 715 } 716 717 if((style_bar == 'box_vertical_squaren') || 718 (style_bar == 'box_larerSign_squaren')) 719 { 720 numberItem = cur; 721 } 722 723 if((style_bar == 'horizontal_round') || 724 (style_bar == 'horizontal_squaren') 725 ) { 726 numberItem = nex; 727 } 728 729 if(numberItem || numberItem == '0') { 730 if(event == 'next') { 731 form 732 .find(".cf7mls_progress_bar li") 733 .eq(numberItem) 734 .addClass("cf7mls-steps-item-finish"); 735 }else if(event == 'back') { 736 form 737 .find(".cf7mls_progress_bar li") 738 .eq(numberItem) 739 .removeClass("cf7mls-steps-item-finish"); 740 } 741 742 } 743 } 744 745 function cf7mls_color_bar(color, id_form, el) { 746 let style_bar = 'cf7mls_bar_style_' + $(el).find('.cf7mls_progress_bar').attr('data-bg-style-bar'); 747 let style_text = 'cf7mls_bar_style_text_' + $(el).find('.cf7mls_progress_bar').attr('data-style-text'); 748 749 let css_item_icon = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7_mls_steps_item_icon { background: '+ color + ';}'; 750 let css_item_icon_befor = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active:before { background: '+ color + ';}'; 751 let css_bg_li = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active{ background: '+ color + ';}'; 752 let css_step = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7_mls_count_step{ color: '+ color + ';}' 753 let css_check = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7_mls_check{ color: '+ color + ';}'; 754 let css_li_after = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active:after{background: '+ color + ';}'; 755 let css_active_title = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.active .cf7mls_progress_bar_title{color: #fff;}'; 756 let classItemFinsish = '.' + style_bar + '.' + style_text + '[data-id-form="'+ id_form +'"]' + ' li.cf7mls-steps-item-finish'; 757 let classCurrent = '.' + style_bar + '.' + style_text + ' li.current';
758 let css_title_after = '.cf7mls_progress_bar_title:after{background: '+ color + ';}'; 759 let css_title_border = '.cf7mls_progress_bar_title:after{border-color: '+ color + ';}'; 760 let css_li_cur = '.' + style_bar + '.' + style_text + ' li.current + li:after{ background: '+ color + ';}'; 761 762 let css_progress_bar = ''; 763 // progress bar on computer 764 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 765 (style_bar == 'cf7mls_bar_style_largerSign_squaren') || 766 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') || 767 (style_bar == 'cf7mls_bar_style_largerSign_round') 768 ) { 769 switch (style_text) { 770 case 'cf7mls_bar_style_text_horizontal': 771 css_progress_bar += css_item_icon; 772 773 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 774 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') 775 ) { 776 css_progress_bar += classItemFinsish + ' ' + css_title_after; 777 } 778 779 if((style_bar == 'cf7mls_bar_style_largerSign_squaren') || 780 (style_bar == 'cf7mls_bar_style_largerSign_round') 781 ) { 782 css_progress_bar += classItemFinsish + ' ' + '.cf7_mls_arrow_point_to_righ svg {fill: '+ color + ';}'; 783 } 784 785 break; 786 787 case 'cf7mls_bar_style_text_vertical': 788 css_progress_bar += css_item_icon_befor; 789 790 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 791 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') 792 ) { 793 css_progress_bar += classItemFinsish + ':after{ background: '+ color + ';}'; 794 } 795 796 if((style_bar == 'cf7mls_bar_style_largerSign_squaren') || 797 (style_bar == 'cf7mls_bar_style_largerSign_round') 798 ) { 799 css_progress_bar += classItemFinsish + ':after{ border-color: '+ color + ';}'; 800 } 801 802 break; 803 804 case 'cf7mls_bar_style_text_no': 805 css_progress_bar += css_item_icon; 806 807 if((style_bar == 'cf7mls_bar_style_navigation_horizontal_squaren') || 808 (style_bar == 'cf7mls_bar_style_navigation_horizontal_round') 809 ) { 810 css_progress_bar += classItemFinsish + ' ' + css_title_after; 811 } 812 813 if((style_bar == 'cf7mls_bar_style_largerSign_squaren') || 814 (style_bar == 'cf7mls_bar_style_largerSign_round') 815 ) { 816 css_progress_bar += classItemFinsish + ' ' + css_title_border; 817 } 818 break; 819 } 820 } 821 822 if((style_bar == 'cf7mls_bar_style_horizontal_squaren') || 823 (style_bar == 'cf7mls_bar_style_horizontal_round') 824 ) { 825 if(style_text == 'cf7mls_bar_style_text_horizontal') { 826 css_progress_bar += css_item_icon; 827 css_progress_bar += classCurrent + ':before {background-color:' + color + '}'; 828 } 829 830 if((style_text == 'cf7mls_bar_style_text_vertical') || 831 (style_text == 'cf7mls_bar_style_text_no')) { 832 css_progress_bar += css_item_icon_befor; 833 css_progress_bar += classCurrent + ':after {background-color:' + color + '}'; 834 } 835 } 836 837 if(((style_bar == 'cf7mls_bar_style_box_vertical_squaren') || 838 (style_bar == 'cf7mls_bar_style_box_larerSign_squaren')) && 839 (style_text) 840 ) { 841 css_progress_bar += css_bg_li; 842 css_progress_bar += css_step; 843 css_progress_bar += css_check; 844 css_progress_bar += css_li_after; 845 css_progress_bar += css_active_title; 846 } 847 848 if(style_bar == 'cf7mls_bar_style_box_larerSign_squaren') { 849 css_progress_bar += css_li_cur; 850 } 851 852 jQuery('style#cf7mls_style_progress_bar_' + id_form).text(css_progress_bar); 853 } 854 855 // progress bar in ipad and mobie phone 856 function cf7mls_bar_process(form) { 857 let number_step_cur = form.find('.cf7mls_progress_bar li.current').attr('data-counter'); 858 let number_step = form.find('.cf7mls_number_step_wrap').attr('data-number-step'); 859 let bg_color = form.find('.cf7mls_number_step_wrap').attr('data-bg-color'); 860 if(number_step_cur && number_step) { 861 form.find('.cf7mls_number_step_wrap .cf7mls_number').text(number_step_cur + '/' + number_step); 862 let title = $(form.find('.cf7mls_progress_bar li')[Number(number_step_cur) - 1]).find('.cf7mls_progress_bar_title').text(); 863 form.find('.cf7mls_number_step_wrap .cf7mls_step_current').text(title); 864 let percent_step = 100 / (Number(number_step) - 1); 865 if(number_step_cur == '1') { 866 form.find('.cf7mls_number_step_wrap .cf7mls_progress_barinner').css('width', ''); 867 }else { 868 form.find('.cf7mls_number_step_wrap .cf7mls_progress_barinner').css('width', ((percent_step * (Number(number_step_cur) - 1)) + '%')); 869 } 870 } 871 872 if(bg_color) { 873 form.find('.cf7mls_number_step_wrap .cf7mls_progress_barinner').css('background', bg_color); 874 } 875 } 876 877 function cf7mls_transition_effects(form, transitions_bt) { 878 var transition_effects = $(form).find(".fieldset-cf7mls-wrapper").attr("data-transition-effects"); 879 if(transition_effects && typeof transition_effects !== undefined) { 880 var effects = transition_effects.split(" "); 881 var effect_form = { 882 transition_effects: transition_effects, 883 effects_back: '', 884 effects_next: '', 885 effects_in: '' 886 }; 887 888 jQuery.each(effects, function(index, effect){ 889 var es = effect.split("_"); 890 891 switch(es[0]) { 892 case 'back': 893 effect_form.effects_back = es[1]; 894 break; 895 case 'next': 896 effect_form.effects_next = es[1]; 897 break; 898 case 'in': 899 effect_form.effects_in = es[1]; 900 break; 901 } 902 }) 903 904 if(transitions_bt == 'effects_in') { 905 $(form).find('.fieldset-cf7mls-wrapper .cf7mls_current_fs').addClass(effect_form.effects_in + ' ' +"animated"); 906 }else if(form.find(".fieldset-cf7mls-wrapper").length && transitions_bt) { 907 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass(effect_form.effects_back); 908 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass(effect_form.effects_next); 909 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass(effect_form.effects_in); 910 form.find(".fieldset-cf7mls-wrapper .fieldset-cf7mls").removeClass('animated'); 911 form.find(".fieldset-cf7mls-wrapper .cf7mls_current_fs").addClass(effect_form[transitions_bt] + ' ' + "animated"); 912 } 913 } 914 } 915 916})(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.