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