| 1 |
!function(a){"use strict";a(document).ready(function(){var s=a("form.wpcf7-form");s.each(function(){if(a(this).is("div.cf7_2_post form.wpcf7-form")){var s=a(this).closest("div.cf7_2_post").attr("id");a(this).on(s,function(){a("input.cf7sg-benchmark",a(this)).cf7sgBenchmark(!1)})}}),s.on("change","input.cf7sg-benchmark",function(s){a(s.target).cf7sgBenchmark(!0)}),s.on("click","span.dashicons-no-alt",function(s){var n=a(s.target);n.is("span.cf7sg-benchmark-warning .dashicons-no-alt")&&(n.closest("span.cf7sg-benchmark-warning").hide(),n.remove())})}),a.fn.cf7sgBenchmark=function(s){if(void 0===s&&(s=!1),!a(this).is("input.cf7sg-benchmark"))return a(this);if(a(this).removeClass("cf7sg-benchmark-warning"),a(this).next("span.cf7sg-benchmark-warning").remove(),""==a(this).val())return a(this);var n=a(this).data("cf7sg-benchmark"),i="";a(this).is('input[type="hidden"]')&&(i=" cf7sg-benchmark-hidden");var t='<span class="cf7sg-benchmark-warning'+i+'"><span>warning<span class="dashicons dashicons-no-alt"></span></span><span class="cf7sg-benchmark-msg">'+a(this).data("cf7sg-benchmark-msg")+"</span></span>";switch(n){case"above":var c=a(this).data("cf7sg-benchmark-limit");a(this).val()>c&&(a(this).after(t),s||a(this).next("span.cf7sg-benchmark-warning").hide().find(".dashicons-no-alt").remove(),a(this).addClass("cf7sg-benchmark-warning"),i.length>0&&a(this).trigger("cf7sg-benchmark-"+a(this).attr("name")));break;case"below":c=a(this).data("cf7sg-benchmark-limit");a(this).val()<c&&(a(this).after(t),s||a(this).next("span.cf7sg-benchmark-warning").hide().find(".dashicons-no-alt").remove(),a(this).addClass("cf7sg-benchmark-warning"),i.length>0&&a(this).trigger("cf7sg-benchmark-"+a(this).attr("name")));break;case"range":var e=a(this).data("cf7sg-benchmark-min"),h=a(this).data("cf7sg-benchmark-max");(a(this).val()<e||a(this).val()>h)&&(a(this).after(t),s||a(this).next("span.cf7sg-benchmark-warning").hide().find(".dashicons-no-alt").remove(),a(this).addClass("cf7sg-benchmark-warning"),i.length>0&&a(this).trigger("cf7sg-benchmark-"+a(this).attr("name")))}}}(jQuery); |