0byt3m1n1
Path:
/
var
/
www
/
listcrawler.app
/
public_html
/
js
/
[
Home
]
File: app.js
(function ($) { "use strict"; /* --------------------------------------------- Navigation menu --------------------------------------------- */ // dropdown for mobile $(document).ready(function () { checkWidth(true); $(window).resize(function () { checkWidth(false); }); //if cookie hasn't been set... /*if (document.cookie.indexOf("lc_over18=true")<0) { var age_accept_flag = 0; $("#myModal").modal("show"); //Modal has been shown, now set a cookie so it never comes back $("#age_accept").click(function () { $("#myModal").modal('hide'); $("#myModal").attr("style", "z-index:-1;"); age_accept_flag = 1; document.cookie = "lc_over18=true; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/"; }); $("#age_reject").click(function () { $("#myModal").modal('hide'); window.location.href = "https://www.w4mmaps.com/"; }); /*if (age_accept_flag == 0) { $('#myModal').on('hidden.bs.modal', function(e) { window.location.href = "https://www.google.com"; }); }*/ /*} else { $("#myModal").attr("style", "z-index:-1;"); }*/ // Pics on Ad listing page $("#img1").click(function(){ var img_1 = $('#aimg1').attr('src'); $('#img1').removeClass( "thumb-inactive" ).addClass("thumb-active"); $('#img2').removeClass( "thumb-active" ).addClass("thumb-inactive"); $('#img3').removeClass( "thumb-active" ).addClass("thumb-inactive"); // Change src attribute of image $('#mainpic').attr("src", img_1); $('#link-mainpic').attr("href", img_1); // Set herf value }); $("#img2").click(function(){ var img_2 = $('#aimg2').attr('src'); $('#img2').removeClass( "thumb-inactive" ).addClass("thumb-active"); $('#img1').removeClass( "thumb-active" ).addClass("thumb-inactive"); $('#img3').removeClass( "thumb-active" ).addClass("thumb-inactive"); // Change src attribute of image $('#mainpic').attr("src", img_2); $('#link-mainpic').attr("href", img_2); // Set herf value }); $("#img3").click(function(){ var img_3 = $('#aimg3').attr('src'); $('#img3').removeClass( "thumb-inactive" ).addClass("thumb-active"); $('#img1').removeClass( "thumb-active" ).addClass("thumb-inactive"); $('#img2').removeClass( "thumb-active" ).addClass("thumb-inactive"); // Change src attribute of image $('#mainpic').attr("src", img_3); $('#link-mainpic').attr("href", img_3); // Set herf value }); // Popunder $(".popunder").click(function(){ var p_link = $(this).attr('data-lc'); window.open(p_link); }); // View message form $("#btn-mobile-number").click(function() { $("#send-message-modal").modal("show"); $("#send-message-modal").attr("style", "z-index:1050;"); $("#message").val(''); $("#mobile_number").val(''); $("#fileupload").hide(); }); //third party messaging $("#button-302-redirect").click(function() { var opne_new_window = $("#open_new_window").val(); if ( opne_new_window == 'Y' ) { window.open("/messages", "_blank"); } else { window.location.href = "/messages"; } }); $.validator.addMethod( "validNumber", function(value, element) { if( value.substr(0,1) == '0' || value.substr(0,1) == '1'){ return false; } return true; }, "Please enter a valid mobile phone number" ); $("#file").change(function(){ $("#fileupload").show(200); }); // Submit message form $('#send_message').validate({ submitHandler: function(form) { $("#number-error").html(''); var mobile_number = $("#mobile_number").val(); var location_id = $("#location_id").val(); /*if( mobile_number.substr(0,1) == '0' || mobile_number.substr(0,1) == '1'){ $("#number-error").html('Please enter a valid 10 digits mobile number'); return false; }*/ $.ajax({ url: '/ajax/send-message.php', type: 'POST', data: { mobile_number: mobile_number, location_id: location_id }, success: function(result) { $("#send-message-modal").modal("hide"); $("#send-message-modal").attr("style", "z-index:-1;"); //$("#mobile-number").html(result); $("#message-confirmation").modal("show"); $("#message-confirmation").attr("style", "z-index:1200;"); setTimeout(function(){ $("#message-confirmation").modal("hide"); $("#message-confirmation").attr("style", "z-index:-1;"); }, 1000); } }); }, rules: { message: { required: true, minlength: 10 }, mobile_number: { required: true, digits: true, minlength: 10, maxlength: 10, validNumber:true } }, messages: { message: { required: "You can't send a blank message, please write something", minlength: "Minimum 10 characters" }, mobile_number: { required: "Please enter a valid mobile phone number", minlength: "Please enter a valid mobile phone number", minlength: "Please enter a valid mobile phone number" } } }); }); function checkWidth(init) { // If browser resized, check width again if ($(window).width() <= 991) { $('.dropdown-submenu a').on("click", function (e) { $(this).next('ul').toggle(); e.stopPropagation(); e.preventDefault(); }); } } function navMenu() { // main menu toggleer icon (Mobile site only) $('[data-toggle="navbarToggler"]').click(function () { $('.navbar').toggleClass('active'); $('body').toggleClass('offcanvas--open'); }); // main menu toggleer icon $('.navbar-toggler').click(function () { $('.navbar-toggler-icon').toggleClass('active'); }); // Navbar moved up var $stickyNav = $(".navbar-sticky"); $(window).on("scroll load", function () { var scroll = $(window).scrollTop(); if (scroll >= 120) { $stickyNav.addClass("navbar-sticky--moved-up"); } else { $stickyNav.removeClass("navbar-sticky--moved-up"); } // apply transition if (scroll >= 250) { $stickyNav.addClass("navbar-sticky--transitioned"); } else { $stickyNav.removeClass("navbar-sticky--transitioned"); } // sticky on if (scroll >= 500) { $stickyNav.addClass("navbar-sticky--on"); } else { $stickyNav.removeClass("navbar-sticky--on"); } }); } navMenu(); /* --------------------------------------------- Sticky Sidebar --------------------------------------------- */ function stickyBlockArea() { var stickyBlock = $(".sticky-block"); if (stickyBlock.length > 0) { var position = stickyBlock.position(); var stickyElements = $(".sticky-elements"); var objectlast = $(".stickyBlockEndPoint"); var lHeight = objectlast.position(); $(window).on('scroll load', function () { var windowposition = $(window).scrollTop(); var objHeight = (lHeight.top - parseInt(objectlast.height(), 10)); if (windowposition >= position.top && objHeight >= windowposition) { stickyElements.addClass("sticky-elements--on"); } else { stickyElements.removeClass("sticky-elements--on"); } }); } } stickyBlockArea(); /* --------------------------------------------- smooth Scroll --------------------------------------------- */ function smoothScroll() { $('.navbar .nav-item .nav-link, .smooth-scroll a').on('click', function (event) { var $anchor = $(this); var headerH = '5'; $('.header').outerHeight(); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top - headerH + "px" }, 1200, 'easeInOutExpo'); event.preventDefault(); }); $.extend($.easing, { easeInOutExpo: function (t, e, i, n, s) { return 0 == e ? i : e == s ? i + n : (e /= s / 2) < 1 ? n / 2 * Math.pow(2, 10 * (e - 1)) + i : n / 2 * (-Math.pow(2, -10 * --e) + 2) + i }, }); } smoothScroll(); /* --------------------------------------------- reveal --------------------------------------------- */ function reveal() { window.sr = ScrollReveal(); sr.reveal('.reveal', { duration: 1000, delay: 0, scale: 1, opacity: .2, easing: 'ease-in-out', }); } reveal(); /* --------------------------------------------- Language dropbown --------------------------------------------- */ function languagedropbown() { var $landDropdown = $('.lang-dropdown'); $(".lang-selector__button").on('click', function (e) { $landDropdown.slideToggle("fast"); e.stopPropagation(); }); $(".lang-dropdown__item").on('click', function (e) { $landDropdown.hide(); e.stopPropagation(); }); $("body").on('click', function () { $landDropdown.hide(); }); } languagedropbown(); /*---------------------------------- background image holder -----------------------------------*/ function backgroundHolder() { $(".background-image-holder").each(function () { var thesrc = $(this).attr('src'); $(this).parent().css("background-image", "url(" + thesrc + ")"); $(this).parent().css("background-repeat", "no-repeat"); $(this).hide(); }); } backgroundHolder(); /* --------------------------------------------- Lightobx --------------------------------------------- */ function lightBox() { $('.lightbox').venobox(); } lightBox(); /* --------------------------------------------- homepage-1 Features slider --------------------------------------------- */ function featuresSlider1() { var $swipeTabsContainer = $('.swipe-tabs'), $swipeTabs = $('.swipe-tab'), $swipeTabsContentContainer = $('.swipe-tabs-container'), currentIndex = 0, activeTabClassName = 'active-tab'; $swipeTabsContainer.on('init', function (event, slick) { $swipeTabsContentContainer.removeClass('invisible'); $swipeTabsContainer.removeClass('invisible'); currentIndex = slick.getCurrent(); $swipeTabs.removeClass(activeTabClassName); $('.swipe-tab[data-slick-index=' + currentIndex + ']').addClass(activeTabClassName); }); $swipeTabsContainer.slick({ //slidesToShow: 3.25, slidesToShow: 3, slidesToScroll: 1, arrows: false, infinite: false, swipeToSlide: true, touchThreshold: 10 }); $swipeTabsContentContainer.slick({ asNavFor: $swipeTabsContainer, slidesToShow: 1, slidesToScroll: 1, arrows: false, infinite: false, swipeToSlide: true, draggable: false, touchThreshold: 10 }); $swipeTabs.on('click', function (event) { // gets index of clicked tab currentIndex = $(this).data('slick-index'); $swipeTabs.removeClass(activeTabClassName); $('.swipe-tab[data-slick-index=' + currentIndex + ']').addClass(activeTabClassName); $swipeTabsContainer.slick('slickGoTo', currentIndex); $swipeTabsContentContainer.slick('slickGoTo', currentIndex); }); //initializes slick navigation tabs swipe handler $swipeTabsContentContainer.on('swipe', function (event, slick, direction) { currentIndex = $(this).slick('slickCurrentSlide'); $swipeTabs.removeClass(activeTabClassName); $('.swipe-tab[data-slick-index=' + currentIndex + ']').addClass(activeTabClassName); }); } featuresSlider1(); /* --------------------------------------------- Features homepage-2 slider --------------------------------------------- */ function featuresSlider2() { $(".features--slider-2 .slider-tabs").slick({ slidesToShow: 5, slidesToScroll: 1, asNavFor: '.features--slider-2 .slider-contents', dots: false, arrows: false, centerMode: false, focusOnSelect: true, responsive: [{ breakpoint: 500, settings: { slidesToShow: 2, } }, { breakpoint: 992, settings: { slidesToShow: 3, } }, ] }); $(".features--slider-2 .slider-contents").slick({ slidesToShow: 1, slidesToScroll: 1, autoplay: false, asNavFor: '.features--slider-2 .slider-tabs', prevArrow: '<button type="button" class="slick-prev"><i class="icon icon-triangle-left-18 icon-color-white"></i></button>', nextArrow: '<button type="button" class="slick-next"><i class="icon icon-triangle-right-17 icon-color-white"></i></button>', }); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $(e.target).find('.slider').each(function () { $(this).slick('setPosition'); }) }) } featuresSlider2(); /* --------------------------------------------- Pricing data update --------------------------------------------- */ function pricingData() { var cardValue = $('.card__value'); var cardValueFocused = $('.card__value--focused'); $(".pricing-tab .btn").on('click', function () { $('.pricing-tab .btn').removeClass('btn--bg-primary'); $(this).addClass("btn--bg-primary"); }); $(".data-type-monthly").on('click', function () { cardValue.fadeIn("fast"); cardValueFocused.css('display', 'none'); }); $(".data-type-yearly").on('click', function () { cardValue.css('display', 'none'); cardValueFocused.fadeIn("fast"); }); } pricingData(); /* --------------------------------------------- testimonial carousel --------------------------------------------- */ function testimonialCarousel1() { $(".testimonial-carousel .testimonial-content").slick({ slidesToShow: 1, slidesToScroll: 1, asNavFor: '.testimonial-carousel .testimonial-image', dots: false, arrows: false, centerMode: false, focusOnSelect: true, }); $(".testimonial-carousel .testimonial-image").slick({ slidesToShow: 1, slidesToScroll: 1, autoplay: false, asNavFor: '.testimonial-carousel .testimonial-content', dots: true, customPaging: function (slider, i) { return '<button class="slick-dots--long" id=' + i + "></button>"; }, arrows: false, }); $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { $(e.target).find('.slider').each(function () { $(this).slick('setPosition'); }) }); } testimonialCarousel1(); /* --------------------------------------------- Fixed Footer --------------------------------------------- */ function csselem() { jQuery(".height-emulator").css({ height: jQuery(".footer--fixed").outerHeight(true) }); } csselem(); var jQuerywindow = jQuery(window); jQuerywindow.resize(function () { csselem(); }); /* --------------------------------------------- CountDown --------------------------------------------- */ function countDown() { var second = 1000, minute = second * 60, hour = minute * 60, day = hour * 24; var xPdate = $("#date").data("date"); var countDown = new Date(xPdate).getTime(), x = setInterval(function () { var now = new Date().getTime(), distance = countDown - now; var cDays = document.getElementById("days"); if (cDays) { (document.getElementById("days").innerText = addZero(Math.floor(distance / day)), (document.getElementById("hours").innerText = addZero(Math.floor( (distance % day) / hour ), 2))), (document.getElementById("minutes").innerText = addZero(Math.floor( (distance % hour) / minute ), 2)), (document.getElementById("seconds").innerText = addZero(Math.floor( (distance % minute) / second ), 2)); } }, second); } function addZero(your_number, length) { var num = '' + your_number; while (num.length < length) { num = '0' + num; } return num; } countDown(); /* --------------------------------------------- Preloaded --------------------------------------------- */ /*$(window).on("load", function () { $('.preloader-wapper').addClass('loaded'); if ($('.preloader-wapper').hasClass('loaded')) { $('.preloader-main').delay(1200).queue(function () { $(this).remove(); }); } });*/ })(jQuery);