(function () { "use strict"; /*jslint browser:true*/ /*global $, jQuery, Spinner, google*/ $(document).ready(function () { // New menu starts $(".main-nav ul li.nav > a[href='#']").click(function (e) { e.preventDefault(); }); if ($(window).width() <= 991) { $('.main-nav ul li.nav:has(.submenu-outer)').addClass("accordion-content"); $('.main-nav ul li.nav > a').click(function () { var checkElement = $(this).next(); $('.main-nav li.nav').removeClass('active'); $(this).closest('li.accordion-content').addClass('active'); if (this.text === 'School') { $("li#school").next().addClass("menu-box-shadow"); } else { $("li#school").next().removeClass("menu-box-shadow"); } $(this).closest('li.accordion-content').addClass('active'); if (this.text === 'Home') { $("li#home").next().addClass("menu-box-shadow"); } else { $("li#home").next().removeClass("menu-box-shadow"); } if ((checkElement.is('.submenu-outer')) && (checkElement.is(':visible'))) { $(this).closest('li.nav').removeClass('active'); $("li#school").next().removeClass("menu-box-shadow"); $("li#home").next().removeClass("menu-box-shadow"); checkElement.slideUp('normal'); $("html, body").removeClass("locked"); } if ((checkElement.is('.submenu-outer')) && (!checkElement.is(':visible'))) { $('.main-nav .submenu-outer:visible').slideUp('normal'); checkElement.slideDown('normal'); $("html, body").addClass("locked"); } if (checkElement.is('.submenu-outer')) { return false; } else { return true; } }); $('a.ham-icon').click(function () { $('.main-nav li.nav').removeClass('active'); $('.main-nav .submenu-outer:visible').slideUp('normal'); $("html, body").removeClass("locked"); $(".head-top").toggleClass("active") }); } // New menu ends //New footer starts var d = new Date(); var n = d.getFullYear(); document.getElementById("copyright-year").innerHTML = n; if ($(window).width() <= 992) { $(".new-footer .footer-nav h4:not('#contactus, #stayconnected')").click(function (e) { var clickedElement = $(this).next(); var thisEle = this; if ($(this).next().hasClass('mob-view')) { $(this).find('span').removeClass('arrow-mob-icon'); $(this).next().slideUp(function () { $(thisEle).next().removeClass('mob-view'); $(thisEle).removeClass('rmv-bdr'); }); } else { var openMenu = $(".new-footer .mob-view"); var downarrow = $(".footer-nav .arrow-mob-icon"); $(downarrow).removeClass('arrow-mob-icon'); $(openMenu).slideUp(function () { $(openMenu).removeClass('mob-view'); $(openMenu).siblings('h4').removeClass('rmv-bdr'); }); $(this).next().addClass('mob-view'); $(this).find('span').addClass('arrow-mob-icon'); $(this).next().slideDown(function () { $(thisEle).addClass('rmv-bdr'); }); } e.preventDefault(); }); } /*$(".new-footer .footer-nav ul h4 ").click(function(e){ var clickedElement=$(this).next(); $(this).next().addClass('mob-view');*/ /*$('.new-footer .footer-nav ul h4').click(function () { var nextElement = $(this).next(); $(this).next().addClass('mob-view'); e.preventDefault();*/ //New footer ends $(".loginMenu").prev('a').removeAttr("href").addClass('noLink'); $(".sign-up-btn").parent('li').prev("li").addClass('border-btn-outer'); $(".sign-up-btn").parent('li').prev("li").prev("li").addClass('border-btn-outer'); $(".more-info .col-xs-6:nth-child(2)").after("
"); //Smooth Scrolling $('a[href*="#"]') // Remove links that don't actually link to anything .not('[href="#"]') .not('[href="#0"]') .not('.profile-wrap a') .click(function (event) { // On-page links if ( location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname ) { // Figure out element to scroll to var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); // Does a scroll target exist? if (target.length) { // Only prevent default if animation is actually gonna happen event.preventDefault(); $('html, body').animate({ scrollTop: target.offset().top - 100 }, 0, function () { // Callback after animation // Must change focus! var $target = $(target); $target.focus(); if ($target.is(":focus")) { // Checking if the target was focused return false; } else { $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable $target.focus(); // Set focus again } }); } } }); // var free; // if (typeof isFree === 'undefined') free = ; // else free = isFree; // alert(isFree); // if (free == 1 || free == true || free == 'true') { // window.intercomSettings = { // hide_default_launcher: true // }; // console.log('Is Free' + free); // $('.securly-free').show(); // $('li.securly-free').css('display','inline-block'); // $('.head-top').removeClass('move-down'); // $('.on-boarding .box .questions.securly-free').css('display', 'inline-block'); // $('.icon-que.securly-free').css('display','block'); // $('.main-nav li.securly-free').css('display', 'inline-block') // $('.normal-securly').hide(); // // For home page // $('#Parent-Reports .middle-row').addClass('brdr-btm-nn'); // $('.hero-img').addClass('free-hero-img'); // $('body').addClass('securly-free-pages'); // $('.big-blue-button.btn-hero').on('click', function(e){ // e.preventDefault(); // window.location.href = '/app/try-securly-free' // }) //}; function addButtons() { $('.main-nav > ul > li').each(function (idx, li) { if (($(li).find('ul')).length) { $($(li).find('> a')).attr("aria-haspopup", "true"); $($(li).find('> a')).append(''); } }); } addButtons(); $('.slick-dots').on('keydown', function (e) { $(this).attr('role', 'listbox'); $('.slick-dots li').each(function (idx, item) { $(item).attr('aria-hidden', 'false'); $(item).attr('role', 'option'); }) }); $('.slick-dots li').on('keydown', function () { if ($(this).hasClass('slick-active')) { $(this).attr('aria-selected', 'true'); } else { $(this).attr('aria-selected', 'false'); } }); $('a').on('mousedown', function (e) { e.preventDefault(); }); $('body').mousedown(function () { $(this).addClass('using-mouse'); }); $('body').keydown(function () { $(this).removeClass('using-mouse'); }); var keys = { tab: 9, enter: 13, }; /* Handle "enter" key press on submenu button for menu accessibility using keyboard */ $('.submenu-btn').keypress(function (event) { if (event.which == keys.enter) { event.preventDefault(); if ($(this).attr('aria-expanded') == 'false' || $(this).attr('aria-expanded') == null) { $(this).parents("li:first").addClass('showsubmenu'); $(this).attr('aria-expanded', 'true'); } else { $(this).parents("li:first").removeClass('showsubmenu'); $(this).attr('aria-expanded', 'false'); } } }); /* Close submenus when navigating to different menu item */ $('li.nav > a').focus(function () { $(document).click(); }); /* Close submenus when clicked outside navigation */ $(document).click(function () { var open = $('li.showsubmenu'); open.each(function (elem) { $(this).removeClass('showsubmenu'); $(this).find('.submenu-btn').attr("aria-expanded", "false"); }); }); $("body").css({ visibility: 'visible' }); var mainUrl = mainUrl || 'www.securly.com'; $('.inputLink').val(mainUrl + $('.inputLink').val()); /*$('#hero-para').parallax("50%", 0.22);*/ var wpOffset = 80, $portfolioContainer = $('.portfolio-container'), $articleContainer = $('.article-container'), isMobile = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)); /*Login functions for Parents*/ $("#parent-login").submit(function (e) { $('.pass-error').remove(); var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}$/; if (re.test($('#login-password').val()) && e.target.checkValidity()) { $.ajax({ type: "POST", url: gUrlHome + "/_login.php", data: { email: $('#cemail').val(), password: $('#login-password').val() }, dataType: JSON, complete: function (xhr, textStatus) { if (xhr.status == 200) { window.location.href = "/app/#/"; } else if (xhr.status == 500) { $("#normal-login h3").append('Inncorrect email or password'); } else if (xhr.status == 401) { $("#normal-login h3").append('Inncorrect email or password'); } }, error: function (jqXHR, textStatus, errorThrown) { } }); } else if (!re.test($('#login-password').val())) { $('pass-error').remove(); $('#normal-login h3').append('Password or Username is invalid.'); } return false; }); $("#reset-login").submit(function (e) { $('.pass-error').remove(); if (e.target.checkValidity()) { $.ajax({ type: "GET", url: gUrlHome + "/_passwordReset?email=" + encodeURIComponent($('#reset-email').val()), complete: function (xhr, textStatus) { if (xhr.status == 200) { $('#reset-login').append('An email has been sent to ' + $('#reset-email').val() + '
Please click the link in that email to reset your password in the next 72 hours.
'); $('#reset-password-button').remove(); $('.reset-input').remove(); } else if (xhr.status == 500) { $('#reset h3').append('This email is not registered.'); } }, error: function (jqXHR, textStatus, errorThrown) { } }); } return false; }); $("#reset-password").submit(function (e) { if ($('#confirm').val() != '') { return false; } $('.pass-error').remove(); if ($('#password-reset').val() != $('#password-reset-conf').val()) { $('#reset-password').append('Password mismatch'); return false; }; var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}$/; if (re.test($('#password-reset').val()) && e.target.checkValidity()) { var token = getUrlParameter('token'); if (!token) { window.location.href = "/app/#/"; } $.ajax({ type: "POST", url: gUrlHome + "/_passwordReset", data: { password: $('#password-reset').val(), token: token }, complete: function (xhr, textStatus) { if (xhr.status == 200) { /*go to login page*/ window.location.href = "/app/#/"; /*document.getElementById('login-btn').click();*/ } else if (xhr.status == 500) { $('.forgot-password').append('Inncorrect email or password'); } }, success: function (xhr, textStatus) { //console.log(xhr, textStatus, 'status scuccs'); }, error: function (jqXHR, textStatus, errorThrown) { } }); } else if (!re.test($('#parent-password').val())) { $('#reset-password').append('Password must contain at least one capital and one lowercase letter along with a number.'); } return false; }); /*Signup functions for Parents*/ var d = new Date(); var tzOff = d.getTimezoneOffset(); /*$('#sign-up').submit(function(e){ if ($('#confirm').val() != '') { return false; } var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}$/; if (re.test($('#parent-password').val()) && e.target.checkValidity()) { $.ajax({ type: "POST", url: gUrlHome + "/_signupconsumer.php", data: {email: $('#parent-email').val(), password: $('#parent-password').val(), tzOffset: tzOff, tzName: timezone.name()}, dataType: JSON, complete: function(xhr, textStatus){ if(xhr.status == 200) { window.location.href= '/app/#/'; } }, error: function(jqXHR, textStatus, errorThrown) { console.log(jqXHR, textStatus, errorThrown); if(jqXHR.status == 409) { $('.pass-error').remove(); $('#parent-signup-form .no-credit').append('This email is already registered.'); } return false } }); } else if (!re.test($('#parent-password').val())){ $('.pass-error').remove(); $('#parent-signup-form .no-credit').append('Password must contain at least one capital and one lowercase letter along with a number.'); } return false; });*/ // Fade in body on page load (JS enabled only!) $('body').addClass('loaded'); /*$('input').on('focus', function() { $('.head-top').addClass('input-selected'); }) $('input').on('blur', function() { $('.head-top').removeClass('input-selected'); })*/ //News and Events Tab $('ul.tabs').each(function () { var $active, $content, $links = $(this).find('a'); $active = $($links.filter('[href="' + location.hash + '"]')[0] || $links[0]); $active.addClass('active'); $content = $($active[0].hash); $links.not($active).each(function () { $(this.hash).hide(); }); $(this).on('click', 'a', function (e) { $active.removeClass('active'); $content.hide(); $active = $(this); $content = $(this.hash); $active.addClass('active'); $content.show(); // e.preventDefault(); }); }); // Resources page mobile tab $('.mb-tab select').change(function () { $(this).find("option:selected").each(function () { let optionValue = $(this).attr("value"); if (optionValue) { $(".tab-page").not("#" + optionValue).hide(); $("#" + optionValue).show(); } else { $(".tab-page").hide(); } }); }); //News and Events tab styling $('.news-section .tabs').each(function () { var $active, $links = $(this).find('a'); $links.removeClass('active'); $active = $links.filter('[href="/' + location.pathname.split("/")[1] + '"]'); $active.addClass('active'); $(this).on('click', 'a', function (e) { $active.removeClass('active'); }); }); $('input').blur(function () { if ($(this).val().length != 0) { $(this).addClass('white-input'); } }); //Calculate Quote Functions function calc() { var undiscounted_price = 6; var seats = 0; var seat_tiers = [500, 1000, 2500, 5000, 10000, 25000]; var discount_tiers = [0, .22, .39, .61, .58, .69]; var total_price = 0; var idx_seats, idx_tiers; seats = $('.num-students').val(); if (seats >= 25001) { $('.quote-parent').addClass('hidden'); $('.calculate-message').removeClass('hidden'); $('.calculate-message').html('Get in touch with sales@securly.com for a custom quote'); return; } for (idx_seats = 1; idx_seats <= seats; idx_seats++) { for (idx_tiers = 0; idx_tiers < 6; idx_tiers++) { if (idx_seats <= seat_tiers[idx_tiers]) { break; } } total_price += 1 * (1 - discount_tiers[idx_tiers]) * undiscounted_price; } total_price = 0.75 * total_price; // (3-year plan) with 25% discount always to prevent people from getting scared $('.calculate-message').addClass('hidden'); $('.quote-parent').removeClass('hidden'); if ((Math.round(total_price)) < 1200) { total_price = 1200 } $('.quote-price').text(Math.round(total_price)); }; $('.get-quote').on('click', function () { calc(); }); //Show Take Home Checkboxes $(".th-check").change(function () { var show = $('.take-home-options').css('display'); if (show == 'none') { $('.take-home-options').show(200); } else { $('.take-home-options').hide(300); } }); //Show Hints var timer; $(".ipadd").on("mouseenter", function () { timer = setTimeout(function () { $(".ipadd + .bubble").removeClass("hidden"); }, 500); }).on("mouseleave", function () { clearTimeout(timer); $(".bubble").addClass("hidden"); }); $(".sources").on("mouseenter", function () { timer = setTimeout(function () { $(".sources .bubble").removeClass("hidden"); }, 500); }).on("mouseleave", function () { clearTimeout(timer); $(".bubble").addClass("hidden"); }); //Numeric /*$('input.numeric').numeric();*/ // Init Superslides /*$('#main-superslides').superslides({ play: 8000, animation: 'fade', slide_easing: 'easeInOutCubic', slide_speed: 800, pagination: true, hashchange: false, scrollable: true }); $('#testimonial-superslides').superslides({ play: 8000, animation: 'fade', slide_easing: 'easeInOutCubic', slide_speed: 800, pagination: false, hashchange: false, scrollable: true });*/ // POPUPs $('#forgot-password').on('click', function () { $('#normal-login').addClass('hidden'); $('#reset').removeClass('hidden'); }); $('#retun-login').on('click', function () { $('#normal-login').removeClass('hidden'); $('#reset').addClass('hidden'); }); $('.popup-vimeo').magnificPopup({ type: 'iframe' }); $('#login-btn').magnificPopup({ items: { src: '#login', type: 'inline' } }); $('#parent-video-btn').magnificPopup({ items: { src: '#parent-video', type: 'inline' } }); $('.already').magnificPopup({ items: { src: '#login', type: 'inline' } }); $('.get-started-link').magnificPopup({ items: { src: '#sign-up', type: 'inline' } }); $('.get-started').magnificPopup({ items: { src: '#sign-up', type: 'inline' } }); $('.login-btn').on('click', function () { $('.main-nav').removeClass('trigger-active'); }); //NEWSLETTER POPUP $('.newsletter-btn').magnificPopup({ items: { src: '#freetrial_inline', type: 'inline' } }); //WHITE PAPER POPUP $('.whitepaper-btn').magnificPopup({ items: { src: '#whitepaper_inline', type: 'inline' } }); //LEARN MORE POPUP $('.learn-more-btn').magnificPopup({ items: { src: '#learn-more-form', type: 'inline' } }); // FORM VALIDATOR /*$("form").validate();*/ // Shrink top bar size on scroll function checkPosition() { var targetOffset = $("#content").offset().top + 65, topBar = $('.head-top'); if ($(window).scrollTop() > 0) { topBar.addClass('shrink'); } else { topBar.removeClass('shrink'); } if ($(window).scrollTop() >= targetOffset) { topBar.addClass('darken'); } else { topBar.removeClass('darken'); } } var hasContent = $("#content").length; if (hasContent > 0) { //checkPosition(); $(document).scroll(function () { //checkPosition(); }); } // Toggle side-active class, show/hide meta menu $(document).on("click", ".side-active .page-content, .side-active .page-top, body:not(.side-active) .side-meta, body:not(.side-active) .toggle-side, .close-side", function () { $('body').toggleClass('side-active'); }); // Mobile: open menu on nav trigger tap $(document).on("click", ".nav-trigger", function (e) { e.preventDefault(); $(this).toggleClass('active'); $(this).attr('aria-expanded', function (i, attr) { return attr == 'true' ? 'false' : 'true'; }); $('.main-nav').toggleClass('trigger-active'); $('.main-nav > ul').append('
'); //flag keyboard focus reached last menu item }); $(document).on('focus', '.endofmenu', function () { $('.nav-trigger').focus(); $('.nav-trigger').click(); }); $('.nav-trigger').keypress(function (event) { $(this).click(); }); $(document).on("click", "#login-btn", function () { $(this).toggleClass('active'); $('.main-nav').toggleClass('trigger-active'); }); // Fluid embed heights // $("#main").fitVids(); // Vertical tabs move to tab content top on nav click $(document).on("click", '.vertical-tabs .tab-nav a', function () { $('html, body').stop(true, true).animate({ scrollTop: $(this).closest('.vertical-tabs').find('.tab-content').offset().top }, 200); }); // Main header enter button click, move wrap to top $(document).on("click", ".to-top", function () { $('html, body').animate({ scrollTop: 0 }, 1000); return false; }); // Init parallax effect on page header backgrounds function initParallax() { if (!isMobile) { $('.page-head, .parallax').each(function () { $(this).css('background-attachment', 'fixed').parallax("50%", 0.5, true); }); } } initParallax(); // Create header top bar blur effect function createHeaderBlur() { var headImage = $('.page-head').css('background-image'); if (headImage !== undefined) { $('.cssfilters .head-top').append('
').find('.background-blur').css('background-image', headImage); } } createHeaderBlur(); // Init waypoints + animate.css functionality /*if (!isMobile) { $.fn.waypoint.defaults = { context: window, continuous: true, enabled: true, horizontal: false, offset: 0, triggerOnce: false }; $('.animated').waypoint(function () { var elem = $(this), animation = elem.data('animation'), timeout; if (!elem.hasClass('visible') && elem.attr('data-animation') !== undefined) { if (elem.attr('data-animation-delay') !== undefined) { timeout = elem.data('animation-delay'); setTimeout(function () { elem.addClass(animation + " visible"); }, timeout); } else { elem.addClass(elem.data('animation') + " visible"); } } }, { offset: wpOffset + '%' }); } else { $('.animated').removeClass('animated'); }*/ // Init HTML5 placeholder polyfill for IE <10 // $('input, textarea').placeholder(); // Windows resize function $(window).resize(function () { initParallax(); // $portfolioContainer.isotope(); // $articleContainer.isotope(); }); // Init any Flexslider plugin // Init any Magnific Popup plugin // For all available options, check here: http://dimsemenov.com/plugins/magnific-popup/documentation.html#options $('.gallery-container').magnificPopup({ delegate: 'a', type: 'image', gallery: { enabled: true }, removalDelay: 300, mainClass: 'mfp-fade' }); $('.popup-iframe').magnificPopup({ type: 'iframe', mainClass: 'mfp-fade', removalDelay: 300, preloader: false, fixedContentPos: false }); // Article Grid Isotope // $articleContainer.isotope(); // Portfolio Isotope + filtering // $portfolioContainer.isotope(); $(document).on("click", ".portfolio-filter a", function () { var $this = $(this), selector; $this.closest('.portfolio-filter').find('a').removeClass('selected'); $this.toggleClass('selected'); selector = $this.data('filter'); // $portfolioContainer.isotope({ // filter: selector, // resizable: true // }); return false; }); // Setup validation for contact form function setupContactFormValidation() { // Contact form validation & AJAX submit // Create loading spinner var spinnerOpts = { lines: 9, // The number of lines to draw length: 0, // The length of each line width: 5, // The line thickness radius: 11, // The radius of the inner circle corners: 1, // Corner roundness (0..1) rotate: 0, // The rotation offset direction: 1, // 1: clockwise, -1: counterclockwise color: '#000', // #rgb or #rrggbb speed: 1, // Rounds per second trail: 60, // Afterglow percentage shadow: false, // Whether to render a shadow hwaccel: true, // Whether to use hardware acceleration className: 'spinner', // The CSS class to assign to the spinner zIndex: 2e9, // The z-index (defaults to 2000000000) top: '0', // Top position relative to parent in px left: '0' // Left position relative to parent in px }, // targetSpinner = $('.spinner-holder').hide(), feedbackElem, spinnerElem; // new Spinner(spinnerOpts).spin(targetSpinner[0]); /* $("#contactForm").validate({ submitHandler: function (form) { feedbackElem = $(form).find('.feedback-text').hide(); spinnerElem = $(form).find('.spinner-holder').fadeIn(300); // If it validates, send the form jQuery(form).ajaxSubmit({ //target: "#loader", success: function () { // Fade out the spinner and show the succes text spinnerElem.fadeOut(300, function () { feedbackElem.fadeIn(300).text("Thank you for your message, we'll get back to you ASAP!"); }); $(form).find('input[type="submit"]').attr('disabled', 'disabled'); } }); return false; } }); */ } setupContactFormValidation(); // Init Google Maps function initGoogleMaps() { // Init on contact page if ($('#contact-map').length > 0) { var myLatlng = new google.maps.LatLng(37.40404, -121.97898), mapOptions = { center: myLatlng, zoom: 19, mapTypeId: google.maps.MapTypeId.SATELLITE, scrollwheel: false // disableDefaultUI: true }, map = new google.maps.Map(document.getElementById("contact-map"), mapOptions), marker = new google.maps.Marker({ position: myLatlng, map: map, title: "Come visit us" }); } } initGoogleMaps(); }); }()); // Comparison pages JS $(document).ready(function () { // Slider $('.mo-carousel').slick({ dots: false, arrows: true, infinite: false, centerMode: false, slidesToShow: 1, slidesToScroll: 1, centerPadding: '0', }); $('.mo-carousel').on('afterChange', function () { $(".fourth-col, .fifth-col, .sixth-col").hide(); var dataId = $('.slick-current').attr('data-slick-index'); if (dataId == 0) { $('.fourth-col').show(); } else if (dataId == 1) { $('.fifth-col').show(); } else if (dataId == 2) { $('.sixth-col').show(); } }); // Table $('.div-table .div-table-toggle:first').show(); $('.div-table .first-col:first').addClass('active'); $('.div-table .first-col a').on('click', function (e) { e.preventDefault(); }); let firstCol = '.div-table .first-col'; $(firstCol).on('click', function () { $(this).next().next('.div-table-toggle').stop(true).slideToggle('fast') .siblings('.div-table-toggle:visible').stop(true).slideUp('fast'); $(this).toggleClass('active'); $(this).siblings(firstCol).removeClass('active'); }); $(window).on("ready resize", function () { // Tooltip if ($(window).width() < 768) { $('.div-table .css-tooltip').click(function () { $('.div-table .css-tooltip .tooltiptext').removeClass('active'); $(this).find('.tooltiptext').addClass('active'); }); } else { $('.div-table .css-tooltip').hover(function () { $(this).find('.tooltiptext').addClass('active'); }, function () { $(this).find('.tooltiptext').removeClass('active'); }); } $(window).scroll(function () { if ($(window).width() < 768) { $('.div-table .css-tooltip .tooltiptext').removeClass('active'); } else { $('.div-table .css-tooltip .tooltiptext.active').hide(); setTimeout(function () { $('.div-table .css-tooltip .tooltiptext').removeAttr("style"); }, 1000); } }); }); });