PageSourceSearch

https://ofaclawyer.net/wp-content/themes/ofaclawyers/js/main.js?ver=a8b023146eb8378e850df2aca8d4ca6e

js ofaclawyer.net collected 2026-10-02 18:41:39 UTC 16,357 bytes, 487 lines download raw bytes

1// html5lightbox
2jQuery(document).ajaxComplete(function () {
3    jQuery(".html5lightbox").html5lightbox();
4});
5
6jQuery(".form-control").attr("autocomplete", "off");
7
8/**** Img to SVG ****/
9activate('img[src*=".svg"]');
10function activate(string) {
11    jQuery(string).each(function () {
12        var $img = jQuery(this);
13        var imgID = $img.attr('id');
14        var imgClass = $img.attr('class');
15        var imgURL = $img.attr('src');
16        jQuery.get(imgURL, function (data) {
17            // Get the SVG tag, ignore the rest
18            var $svg = jQuery(data).find('svg');
19            // Add replaced image's ID to the new SVG
20            if (typeof imgID !== 'undefined') {
21                $svg = $svg.attr('id', imgID);
22            }
23            // Add replaced image's classes to the new SVG
24            if (typeof imgClass !== 'undefined') {
25                $svg = $svg.attr('class', imgClass + ' replaced-svg');
26            }
27            // Remove any invalid XML tags as per http://validator.w3.org
28            $svg = $svg.removeAttr('xmlns:a');
29            // Replace image with new SVG
30            $img.replaceWith($svg);
31        }, 'xml');
32    });
33}
34
35jQuery(document).ready(function ($) {
36    /*-------------------
37     LAZY LOAD
38     ----------------------*/
39    function lazyimg() {
40        var imgDefer = document.getElementsByTagName('img');
41        for (var i = 0; i < imgDefer.length; i++) {
42            if (imgDefer[i].getAttribute('data-src'
43                    )) {
44                imgDefer[i].setAttribute('src', imgDefer[i].getAttribute('data-src'
45                        ));
46            }
47        }
48        var imgbgDefer = document.querySelectorAll('[data-src-bg]');
49        var style = "background-image: url({url})";
50        for (var i = 0; i < imgbgDefer.length; i++) {
51            imgbgDefer[i].setAttribute('style', style.replace("{url}", imgbgDefer[i].getAttribute('data-src-bg')));
52        }
53    }
54    lazyimg();
55
56
57    jQuery(".go-down").click(function () {
58        jQuery('html,body').animate({
59            scrollTop: jQuery(".home-banner + div").offset().top - 80},
60                'slow');
61    });
62
63    jQuery(".wpcf7-form .form-group input").focus(function () {
64        jQuery(this).next("span").fadeOut(1000);
65        jQuery(this).next(".error").fadeOut(1000);
66    });
67    jQuery(".wpcf7-form textarea").focus(function () {
68        jQuery(this).next("span").fadeOut(1000);
69        jQuery(this).next(".error").fadeOut(1000);
70    });
71
72    jQuery(".wpcf7-form .sign-up-sec input").focus(function () {
73        jQuery(this).next("span").stop();
74        jQuery(this).next("span").addClass("inline-block");
75    });
76
77    /** Mobile Menu ***/
78    $(".mobile-search-bar").click(function () {
79        $("body").addClass("mobile-search-active");
80    });
81    $("#m-close-search").click(function () {
82        $("body").removeClass("mobile-search-active");
83        $("body").removeClass("mobile-search-active");
84        $(".req-error").css("display", "none");
85    });
86    $("#m-SiteSearchs").click(function (event) {
87        event.preventDefault();
88        var mobile_search_val = $("#m-SiteSearchs-form .form-control").val();
89        var trimStr = $.trim(mobile_search_val);
90        if (trimStr) {
91            $(".req-error").hide();
92            $("#m-SiteSearchs-form").submit();
93        } else {
94            $(".req-error").show();
95        }
96    });
97    jQuery(".mobile-search-bar-box input[type='text']").focusin(function () {
98        $(".req-error").hide();
99    });
100    /* mobile end */
101
102    /** Small Header **/
103    jQuery(window).scroll(function () {
104        if (jQuery(this).scrollTop() > 0) {
105            jQuery('#header').addClass('small-header');
106            jQuery('body').addClass('small-menu');
107        } else {
108            jQuery('#header').removeClass('small-header');
109            jQuery('body').removeClass('small-menu');
110        }
111    });
112    $('#search-icon-bar').on('click', function () {
113        $(this).css("opacity", "0");
114        $(".search-bar-box").addClass("active-bar");
115        //$(".search-input-box input").focus();
116        $("#header").addClass("search-bar-opened");
117    });
118    $("#close-search").on('click', function () {
119        $(".search-bar-box").removeClass("active-bar");
120        $("#search-icon-bar").css("opacity", "1");
121        $("#header").removeClass("search-bar-opened");
122    });
123    $(document).click(function (e) {
124        var targetbox = $('.search-box-outer');
125        if (!targetbox.is(e.target) && targetbox.has(e.target).length === 0) {
126            $(".nav-menu").css("opacity", "1");
127            $(".search-bar-box").removeClass("active-bar");
128            $("#search-icon-bar").css("opacity", "1");
129            $("#header").removeClass("search-bar-opened");
130        }
131    });
132    /* Practice Page Service Section */
133
134    var length = $('.service-content-loop').length; // number of elements
135    jQuery(".service-box").hover(function () {
136        var index = $(this).index(); // click element's place
137        // handle classes
138        $('.service-box,.service-content-loop').removeClass('active');
139        $('.service-content-loop:eq(' + index + ')').addClass('active');
140        $(this).addClass('active');
141        // show/hide depending on index  
142        if (index == 0) {
143            $('.prev-tab').addClass("deact");
144            $('.next-tab').removeClass("deact");
145        } else if (index == (length - 1)) {
146            $('.prev-tab').removeClass("deact");
147            $('.next-tab').addClass("deact");
148        } else {
149            $('.prev-tab,.next-tab').removeClass("deact");
150        }
151    });
152
153    $('.next-tab').click(function () {
154        var currentIndex = $('.service-content-loop.active').index(); // get index
155        var nextIndex = currentIndex + 1; // add 1
156        // manage classes
157        $('.service-box, .service-content-loop').removeClass('active');
158        $('.service-content-loop:eq(' + nextIndex + '),.service-box:eq(' + nextIndex + ')').addClass('active');
159        // hide next if last
160        if (nextIndex == (length - 1)) {
161            $(this).addClass("deact");
162            $('.prev-tab').removeClass("deact");
163        }
164    });
165
166    $('.prev-tab').click(function () {
167        var currentIndex = $('.service-content-loop.active').index(); // get index
168        var prev = currentIndex - 1; // add 1
169        // manage classes
170        $('.service-box, .service-content-loop').removeClass('active');
171        $('.service-content-loop:eq(' + prev + '),.service-box:eq(' + prev + ')').addClass('active');
172        // hide prev if first
173        if (prev == 0) {
174            $(this).addClass("deact");
175            $('.next-tab').removeClass("deact");
176        }
177    });
178    /* Home Service Section end  */
179    /* Common Adress Area */
180    jQuery(".nap-wrapper").hover(function () {
181        jQuery(".nap-wrapper").removeClass('active');
182        jQuery(this).addClass('active');
183        jQuery(".map-wrapper").removeClass('active');
184        $prac_id = "#" + jQuery(this).attr("data-id");
185        jQuery($prac_id).addClass("active");
186    });
187
188    /* Case Result Slider Home */
189    jQuery('#case-slider').owlCarousel({
190        loop: true,
191        margin: 15,
192        autoplay: false,
193        autoplayTimeout: 10000,
194        mouseDrag: false,
195        dots: false,
196        nav: false,
197        responsive: {
198            0: {
199                items: 1,
200                autoHeight:true
201            },
202            992: {
203                items: 2
204            },
205            1199: {
206                items: 3
207            }
208        }
209    });
210    /* home case slider */
211    var owl2 = jQuery('#case-slider');
212    owl2.owlCarousel();
213
214    jQuery('.case-prev').click(function () {
215        owl2.trigger('prev.owl.carousel');
216    });
217
218    jQuery('.case-next').click(function () {
219        owl2.trigger('next.owl.carousel', [300]);
220    });  
221
222
223/* client testimonial carousel */
224    jQuery('#testimonial-slider').owlCarousel({
225        loop: true,
226        margin: 15,
227        autoplay: false,
228        autoplayTimeout: 5000,
229        mouseDrag: false,
230        dots: false,
231        nav: false,
232        responsive: {
233            0: {
234                items: 1
235            },
236            768: {
237                items: 1
238            }
239        }
240    });
241    /* home testimonial slider */
242    var owl3 = jQuery('#testimonial-slider');
243    owl3.owlCarousel();
244
245    jQuery('.testprev').click(function () {
246        owl3.trigger('prev.owl.carousel');
247    });
248
249    jQuery('.testnext').click(function () {
250        owl3.trigger('next.owl.carousel', [300]);
251    });
252
253    jQuery(window).load(function () {
254        jQuery(".testnext").trigger('click');
255    });
256    
257    
258    /* end email validation */
259    jQuery(".menu-header li:has(ul)").doubleTapToGo();   
260    
261    /* Full Menu Bar JS */
262    if ($('.menu-bar-wrapper li').hasClass('menu-item-has-children')) {
263        $(".menu-item-has-children > a").after("<span class='sidebar-menu-arrow'></span>");
264    }
265
266    var $toggleButton = $('.menu-button'),
267            $menuWrap = $('.menu-wrap'),
268            $sidebarArrow = $('.sidebar-menu-arrow');
269    // Hamburger Button
270    $toggleButton.on('click', function () {
271        $(this).toggleClass('button-open');
272        $menuWrap.toggleClass('menu-show');
273    });
274    jQuery('.sidebar-menu-arrow').click(function () {
275        // jQuery('.menu-sidebar .menu-bar-wrapper .menu-item-has-children .sub-menu').slideUp(300);
276        jQuery(this).next('.sub-menu').slideUp(300);
277        if (jQuery(this).next().is(':visible')) {
278            jQuery(this).next().slideUp(300);
279        } else {
280            jQuery(this).next().slideDown(300);
281        }
282        if (jQuery(this).hasClass('responsive-up-arrow')) {
283            jQuery(this).removeClass('responsive-up-arrow');
284        } else {
285            //  jQuery('.sidebar-menu-arrow.responsive-up-arrow').removeClass('responsive-up-arrow');
286            jQuery(this).addClass('responsive-up-arrow');
287        }
288    });
289    jQuery('.menu-button').on('click', function () {
290        jQuery('body').toggleClass('nav-open-menu');
291    });
292    /* Full Menu Bar End */
293
294
295}
295);
296/* Blog Sidebar Search Error Message */
297jQuery('<p class="msg-side-form d-none">Required</p>').insertAfter('input.search-field');
298jQuery(".search-submit").click(function () {
299    var searchinput_val = jQuery('input.search-field').val();
300    console.log(searchinput_val);
301    if (searchinput_val == '') {
302        jQuery(".msg-side-form").removeClass('d-none');
303    } else {
304        jQuery(".msg-side-form").addClass('d-none');
305    }
306});
307jQuery('input.search-field').bind('invalid', function () {
308    return false;
309});
310
311
312
313
314/*===== Form Validation =====*/
315
316jQuery(".wpcf7-form input[type='tel']").attr("maxlength", "14");
317jQuery(".wpcf7-form input[type='tel']").attr("minlength", "14");
318var validateEmail = function (elementValue) {
319    var emailPattern = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
320    return emailPattern.test(elementValue);
321};
322jQuery(".wpcf7-form input[type='email']").focusout(function () {
323    var value = jQuery(this).val();
324    var valid = validateEmail(value);
325    if (!valid) {
326        console.log('invalid email');
327        jQuery(this).parent().append("<label class=' error'>Enter Valid Email Address.</label>");
328
329        // jQuery("span.wpcf7-form-control-wrap .email-address").append("<span class='wpcf7-not-valid-tip' aria-hidden='true'>Invalid Email</span>");
330
331    } else {
332        console.log('valid email');
333        jQuery(this).parent().find('.error').remove();
334    }
335});
336function phoneFormatter() {
337    jQuery('input[type="tel"]').on('input', function () {
338        var number = jQuery(this).val().replace(/[^\d]/g, '')
339        // if (number.length <= 7) {
340        // number = number.replace(/(\d{3})(\d{4})/, "$1 $2");
341        // } else
342        if (number.length <= 14) {
343            number = number.replace(/(\d{3})(\d{3})(\d{4})/, "($1) $2 $3");
344        }
345        jQuery(this).val(number)
346    });
347}
348jQuery(phoneFormatter);
349jQuery(".wpcf7-form input[type='tel']").keypress(
350    function (event) {
351        if (event.keyCode == 46 || event.keyCode == 8) {
352        } else {
353            if (event.keyCode < 48 || event.keyCode > 57) {
354                event.preventDefault();
355            }
356        }
357    }
358);
359
360/*===== Not Enter Special Charcter and Numeric =====*/
361jQuery('.FirstName input, .LastName input, .Name input').on('keydown', function (event) {
362    jQuery(this).attr("maxlength", "100");
363    var key = event.which;
364
365    // If space key is pressed
366    //if (key === 32) {
367        //event.preventDefault();
368        //return false;
369   // }
370
371    if (key >= 48 && key <= 57) {
372        event.preventDefault();
373    }
374    if (key >= 96 && key <= 105) {
375        event.preventDefault();
376    }
377});
378jQuery('.FirstName input, .LastName input').bind('.FirstName input, .LastName input', function () {
379    var c = this.selectionStart,
380        r = /[^a-z0-9 .]/gi,
381        v = jQuery(this).val();
382    if (r.test(v)) {
383        jQuery(this).val(v.replace(r, ''));
384        c--;
385    }
386    this.setSelectionRange(c, c);
387});
388jQuery(document).ready(function ($) {
389    // Disable copy and paste
390    $("input.wpcf7-form-control, textarea.wpcf7-form-control").attr("onpaste", "return false");
391    $("input.wpcf7-form-control, textarea.wpcf7-form-control").attr("oncopy", "return false");
392
393    // Define custom validation method for email
394    $.validator.addMethod('validEmail', function(value, element) {
395        var emailPattern = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
396        return this.optional(element) || emailPattern.test(value);
397    }, 'Enter Valid Email Address.');
398
399    // Form validation rules
400    jQuery(".wpcf7-form").validate({
401        rules: {
402            fullname: "required",
403            FirstName: "required",
404            LastName: "required",
405            PhoneNumber: {
406                required: true,
407                minlength: 14,
408                maxlength: 14
409            },
410            EmailAddress: {
411                required: true,
412                validEmail: true // Use the custom email validation method
413            },
414            GraduationDate: "required",
415            GPA: "required",
416            HometownCity: "required",
417            HometownState: "required",
418            UploadEssayHere: "required",
419            UploadResumeHere: "required"
420        },
421        messages: {
422            fullname: "Enter Full Name.",
423            FirstName: "Enter Your First Name.",
424            LastName: "Enter Your Last Name.",
425            PhoneNumber: "Enter Valid Phone Number.",
426            EmailAddress: "Enter Valid Email Address.",
427            GraduationDate: "Enter Graduation Date.",
428            GPA: "Enter Valid GPA.",
429            HometownCity: "Enter Hometown City.",
430            HometownState: "Enter Hometown State.",
431            UploadEssayHere: "Upload Essay Here.",
432            UploadResumeHere: "Upload Resume Here"
433        },
434        errorPlacement: function(error, element) {
435            error.appendTo(element.parent());
436        }
437    });
438});
439
440
441
442
443
444document.addEventListener('change', function (event) {
445
446    // Check if "Agree With All" was clicked
447    if (event.target.matches('input[name="checkBoxAgreeWithAll[]"]')) {
448
449        const agreeAll = event.target;
450
451        const consentFields = document.querySelectorAll(
452            'input[name="consentIntakeSms[]"], ' +
453            'input[name="consentMarketingSms[]"], ' +
454            'input[name="consentMarketingEmail[]"]'
455        );
456
457        consentFields.forEach(function (checkbox) {
458            checkbox.checked = agreeAll.checked;
459        });
460    }
461
462    // Check if one of the individual consent boxes was clicked
463    if (
464        event.target.matches('input[name="consentIntakeSms[]"]') ||
465        event.target.matches('input[name="consentMarketingSms[]"]') ||
466        event.target.matches('input[name="consentMarketingEmail[]"]')
467    ) {
468
469        const agreeAll = document.querySelector(
470            'input[name="checkBoxAgreeWithAll[]"]'
471        );
472
473        const consentFields = document.querySelectorAll(
474            'input[name="consentIntakeSms[]"], ' +
475            'input[name="consentMarketingSms[]"], ' +
476            'input[name="consentMarketingEmail[]"]'
477        );
478
479        if (agreeAll) {
480            agreeAll.checked = Array.from(consentFields).every(function (checkbox) {
481                return checkbox.checked;
482            });
483        }
484    }
485
486});
487

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.