Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function ($) {
- const app = {
- init: () => {
- $(document).on('click', '.installer-btn', app.handleInstaller);
- app.handleOfferBanner();
- $(document).on('click', '.spacial_offer .close_bar', app.handleOfferBanner);
- },
- handleInstaller: () => {
- var url = $('#install-website').val();
- if (app.isValidUrl(url)) {
- url = url + '/wp-admin/plugin-install.php?tab=plugin-information&plugin=wp-dark-mode';
- window.open(url);
- } else {
- $('#install-website').addClass('invalid');
- }
- },
- isValidUrl: (str) => {
- var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
- '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
- '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
- '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
- '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
- '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
- return !!pattern.test(str);
- },
- handleOfferBanner: () => {
- if($('.top_bar.spacial_offer').is(":visible")){
- $('body').addClass('offer-active');
- }else{
- $('body').removeClass('offer-active');
- }
- }
- };
- $(document).ready(app.init);
- })(jQuery);
- (function ($) {
- "use strict";
- $(document).ready(function () {
- // testimonial slider landing page
- $("#testimonial_slider").owlCarousel({
- autoplay: true,
- items: 1,
- loop: true,
- nav: false,
- dot: true
- });
- // WOW js initalization
- new WOW().init();
- });
- // sticky menu
- $(window).on('scroll', function () {
- if ($(this).scrollTop() > 36) {
- $('.navbar').addClass('sticky');
- } else {
- $('.navbar').removeClass('sticky');
- }
- });
- // resize post height controller
- $(function () {
- function reSizeArea(e) {
- var arr = $.makeArray(e);
- var ah = $.map(arr, function (h) {
- return $(h).height();
- });
- var mh = Math.max.apply($(this).height(), ah);
- e.height(mh);
- }
- reSizeArea($('.single_quote > blockquote'));
- if ($(window).width() > 1024) {
- reSizeArea($('.table_head'));
- reSizeArea($('.packages'));
- }
- });
- // pricing page FAQ section
- $(function () {
- $('dd').filter(':nth-child(n+4)').addClass('hide');
- $('dl').on('click', 'dt', function () {
- $('dt').removeClass('open')
- $(this).addClass('open')
- .next()
- .slideDown(300)
- .siblings('dd')
- .slideUp(300);
- });
- });
- // Pricing table plan changing annual and life time
- $(function () {
- $('.basic_plan_lifetime, .pro_plan_lifetime, .ultimate_plan_lifetime').addClass('hide');
- $('#change_plan').on('click', () => {
- $('#change_plan').toggleClass('clicked');
- $('.annual, .lifetime').toggleClass('active')
- $('.basic_plan_lifetime, .pro_plan_lifetime, .ultimate_plan_lifetime, .basic_plan, .pro_plan, .ultimate_plan').toggleClass('hide');
- })
- $('.plan').on('mouseover', function () {
- $('.plan').removeClass('active');
- $(this).addClass('active')
- })
- });
- // Mobile menu and top bar customization
- $(function () {
- $('#main_menu').prepend("<span class='close_menu'></span>");
- var getProBtn = $('.pro_account > ul > li');
- $(".navbar-toggler").on('click', () => {
- $("#main_menu").addClass('open_menu')
- if ($(window).width() > 576) {
- $('#main_menu > #navBar').append(getProBtn);
- }
- })
- $(".close_menu").on('click', () => {
- $("#main_menu").removeClass('open_menu')
- if ($(window).width() > 576) {
- $('.pro_account > ul').append(getProBtn);
- }
- })
- if ($(window).width() < 576) {
- $('#main_menu > #navBar').append(getProBtn);
- $(getProBtn).clone()
- .insertBefore('.banner-content > .btn')
- .children().text("get pro plugin");
- }
- $('.top_bar').prepend("<span class='close_bar'></span>");
- $(".close_bar").on('click', () => {
- $('.top_bar').css('display', 'none');
- })
- })
- // Banner image mode changing
- $(() => {
- $('.dark_btn').on('click', () => {
- $('.dark_btn').addClass('active');
- $('.light_btn').removeClass('active');
- $('.dark_demo').css('display', 'block');
- $('.light_demo').css('display', 'none');
- })
- $('.light_btn').on('click', () => {
- $('.light_btn').addClass('active');
- $('.dark_btn').removeClass('active');
- $('.light_demo').css('display', 'block');
- $('.dark_demo').css('display', 'none');
- })
- setInterval(() => {
- if ($('.dark_btn').hasClass('active')) {
- $('.light_btn').addClass('active');
- $('.dark_btn').removeClass('active');
- $('.light_demo').css('display', 'block');
- $('.dark_demo').css('display', 'none');
- } else {
- $('.dark_btn').addClass('active');
- $('.light_btn').removeClass('active');
- $('.dark_demo').css('display', 'block');
- $('.light_demo').css('display', 'none');
- }
- }, 3000);
- });
- $(window).on('load', function () {
- // jQuery twentytwenty image compare
- $("#image_compare").twentytwenty();
- });
- })(jQuery);
- // top bar coung down timer
- (function () {
- const lastDate = document.getElementById('offer_limit').getAttribute('data-limit');
- // Set the date we're counting down to Y M D
- let countDownDate = new Date(lastDate).getTime();
- // Update the count down every 1 second
- let counter = setInterval(function () {
- // Get today's date and time
- let now = new Date().getTime();
- // Find the distance between now and the count down date
- let distance = countDownDate - now;
- // Formate single digit to double digit
- // const FormatMe = (n) => (n < 10) ? '0' + n : n;
- // Time calculations for days, hours, minutes and seconds
- let days = Math.floor(distance / (1000 * 60 * 60 * 24));
- let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
- let seconds = Math.floor((distance % (1000 * 60)) / 1000);
- // Output the result in an element with id="offer_limit"
- document.getElementById("offer_limit").innerHTML = `
- <ul>
- <li>${days} <span>Days</span></li>
- <li>${hours} <span>Hours</span></li>
- <li>${minutes} <span>Minutes</span></li>
- <li>${seconds} <span>Seconds</span></li>
- </ul>
- `;
- // If the count down is over, write some text
- if (distance < 0) {
- clearInterval(counter);
- // document.getElementById("offer_limit").innerHTML = "EXPIRED";
- document.querySelector('.top_bar').style.display = "none";
- }
- }, 1000);
- $(window).on('load resize orientationchange', function () {
- var navbar_height = $('.navbar').height();
- console.log(navbar_height);
- $('.header.header-banner').css('padding-top', 0 + navbar_height);
- });
- })();
Add Comment
Please, Sign In to add comment