jQuery(document).ready(function($) { // remove empty

tags on the team member bio pages $('.page-template-page-team-bio-php p:empty').css({ 'display' : 'none' }); //----------------------------------------- // URL find and replace //----------------------------------------- // Change the links on page load $('a').each(function(i,link) { link.href = link.href.replace('https://wpmsprod.azurewebsites.net','').replace('https://wpmsprod.azurewebsites.net',''); }); // change legacy blog image links $('.single a').each(function(i,link) { link.href = link.href.replace('https://www.nltblog.com', 'https://wpmsprod.azurewebsites.net').replace('https://www.nltblog.com', 'https://wpmsprod.azurewebsites.net'); }); // change legacy blog image links $('.single img').each(function(i,img) { img.src = img.src.replace('https://www.nltblog.com', 'https://wpmsprod.azurewebsites.net').replace('https://www.nltblog.com', 'https://wpmsprod.azurewebsites.net'); }); //----------------------------------------- // FAQ Questions //----------------------------------------- var modal = $('.modal.faq'); $('.faq-question').on('click', function() { // cache the DOM var $this = $(this); var questionText = $this.text(); var answer = $this.next('.faq-answer').html(); var modalOutput = $('.modal-text'); var modalHeader = $('.modal-header'); // reset all questions and answers // $this.removeClass('bold'); // $('.faq-answer').attr('hidden', true); // output question text to modal modalHeader.text(questionText); modalOutput.html(answer); // make answer to chosen question visible // show modal modal.removeClass('hide').css({ 'display' : 'flex' }); // show overlay layer $('.overlay').removeClass('hide'); }); var modalClose = $('.modal-close'); $('.modal-close, .overlay').on('click', function() { modal.addClass('hide').css({ 'display': 'none' }); }); //----------------------------------------- // Translation Process Questions //----------------------------------------- $('.process-question').on('click', function() { var $this = $(this); var currAnswer = $this.next('.process-answer'); var processGroup = $this.parents('.process-group'); var processQuestionInner = $this.find('.process-question-inner'); // $('.process-answer').addClass('hide'); // $('.process-question').removeClass('process-open'); currAnswer.toggleClass('hide'); processQuestionInner.toggleClass('process-open'); }); //----------------------------------------- // Search functions //----------------------------------------- // set variables var nltSearch; var q; // capture form input $('#nlt-search-input').on('keyup', function() { q = $(this).val(); sessionStorage.setItem('nlt-search', q); }); $(document).foundation(); // fix for forcing https on link in blog sidebar // link: NLT Internlinear $('#menu-item-3026 a').attr('href', 'https://nltinterlinear.com/'); $('.hs_subscription_read_with_us.field').css({ 'margin-bottom': '2rem!important' }); $('.subscription_read_with_us-b8d6abb4-b38a-4c1c-bef1-7635c3532243 span').css({ 'font-size': '2rem!important' }); //----------------------------------------- // Init Sliders (slick slider) //----------------------------------------- $('.testimonials-slider, .passage-highlights-slider, .home-features-slider').slick({ autoplay: true, adaptiveHeight: true, arrows: false, dots: true }); $(".js-toggleMenu").click(function(){ //console.log($("#site-navigation").css("display")); if($("#site-navigation").css("display")==="none"){ $("#site-navigation").slideDown("slow"); }else{ $("#site-navigation").slideUp("slow"); } }); $(".menu-item-has-children a").on("click", function (e) { e.preventDefault(); var subMenu = $(this).next("ul"); if(subMenu.css("display")=="none"){ subMenu.slideDown("slow"); }else{ subMenu.slideUp("slow"); window.location.href = $(this).attr("href"); } }); $(".menu-item-has-children").prepend( "" ); $(".dropdown-toggle").click(function(){ var subMenu = $(this).siblings("ul"); if(subMenu.css("display")=="none"){ subMenu.slideDown("slow"); }else{ subMenu.slideUp("slow"); } }); if($(".wp-block-search__button-outside").length){ var searchForm = $(".wp-block-search__button-outside"), submitBottom = searchForm.find(".wp-block-search__button"); submitBottom.click(function(){ searchForm.attr("action","https://tyndale.com/nlt/"); }) } if($("#gform_submit_button_1").length){ $("#gform_submit_button_1").click(function(e){ var parentForm = $(this).parents("#gform_1"); var scrollDiv = document.getElementById("primary").offsetTop; if($("#input_1_2").val()=="") { $("#input_1_2").after('

Please enter First Name
'); window.scrollTo({ top: scrollDiv, behavior: 'smooth'}); return false; }else if($("#input_1_3").val()=="") { if($(".validate_1").length){$(".validate_1").remove();} $("#input_1_3").after('
Please enter Last Name
'); window.scrollTo({ top: scrollDiv, behavior: 'smooth'}); return false; }else if($("#input_1_4").val()=="") { if($(".validate_1").length){$(".validate_1").remove();} if($(".validate_2").length){$(".validate_2").remove();} $("#input_1_4").after('
Please enter Email Address
'); window.scrollTo({ top: scrollDiv, behavior: 'smooth'}); return false; }else if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("#input_1_4").val()))){ if($(".validateEmail").length){console.log("1"); $(".validateEmail").text("Please enter valid email address"); }else{console.log("2"); $("#input_1_4").after('
Please enter valid email address
'); } window.scrollTo({ top: scrollDiv, behavior: 'smooth'}); return false; } else{ parentForm.attr("action","https://wpmu2.azurewebsites.net/nlt/share-your-story/"); parentForm.submit(); return true; } }); } }); // end jQuery // vanilla JS //------------------------------------------------------------------------- // Old Sliders Code (deprecated) //------------------------------------------------------------------------- //------------------------------------------------------------------------- // Sliders // adapted from: https://www.w3schools.com/howto/howto_js_slideshow.asp // pages: Experienc the NLT, Home //------------------------------------------------------------------------- // var slideIndex = 1; // showSlides(slideIndex); // // // Next/previous controls // function plusSlides(n) { // showSlides(slideIndex += n); // } // // // Thumbnail image controls // function currentSlide(n) { // showSlides(slideIndex = n); // } // // // function showSlides(n) { // var i; // var slide = document.getElementsByClassName("slide"); // // var dots = document.getElementsByClassName("slider-dot"); // if (n > slide.length) {slideIndex = 1} // if (n < 1) {slideIndex = slide.length} // for (i = 0; i < slide.length; i++) { // slide[i].style.display = "none"; // } // // for (i = 0; i < dots.length; i++) { // // dots[i].className = dots[i].className.replace(" slider-dot-active", ""); // // } // slide[slideIndex-1].style.display = "block"; // // dots[slideIndex-1].className += " slider-dot-active"; // }