"use strict"; jQuery(document).ready(function ($) { $('.slider-nav .slick-slide').eq(0).addClass('slick-current'); /** * Pagebuilder default carousel */ if ($('.w-slider-wrap').length > 0) { var slickOptions = { autoplay: false, autoplaySpeed: 3000, fade: false, arrows: false, dots: false, speed: 3000, slidesToShow: 1, draggable: false, swipe: false, centerPadding: '0px', adaptiveHeight: false, asNavFor: '.slider-nav' }, $slick = $('.c-slider-wrap'); $slick.slick(slickOptions); $slick.on('swipe', function (event, slick, direction) { $slick.slick('slickPause'); }); $('.c-slide, .slider-nav').on('click', function () { $slick.slick('slickPause'); }); $('.slider-nav').slick({ speed: 2000, slidesToShow: 9, asNavFor: '.c-slider-wrap', dots: false, centerMode: true, focusOnSelect: true, variableWidth: true, infinite: true, respondTo: 'slick-track' }); } if ($('.w-slider-wrap').length > 0) { $('.c-slider-default').slick({ dots: true, speed: 1000, slidesToShow: 1, slidesToScroll: 4 }); } /** * Ends the current video if the carousel arrows are clicked */ $('.slick-arrow, .slider-nav .slick-slide').click(function () { blockThumbnails(); stopCurrentVideoPlaying(); }); /** * Open Mobile Menu */ $('.c-hamburger').click(function () { $(this).toggleClass('is-open'); $('body').toggleClass('is-open-sidebar'); }); /** * On scroll fixed header */ // Calculate header height var headerHeight = $('.c-header').outerHeight(); $(window).scroll(function () { if ($(window).scrollTop() >= 300) { $('.c-header').addClass('is-fixed'); //Add headerheight to the div with class headerHeight that's in the header.php file $('.headerHeight').css('height', headerHeight); } else { $('.c-header').removeClass('is-fixed'); //Remove headerheight to the div with class headerHeight that's in the header.php file $('.headerHeight').css('height', '0'); } }); /** * On scroll fixed editions */ $(window).scroll(function () { if ($('.c-hero-compare').length > 0) { if ($(window).scrollTop() > $('.c-hero-compare').offset().top + $('.c-hero-compare').outerHeight() - 300) { if ($(window).scrollTop() > $('.c-compare').last().offset().top + $('.c-compare').last().outerHeight() + $('.c-compare-bottom').outerHeight() - $(window).height()) { $('.c-compare-bottom').removeClass('is-fixed'); } else { $('.c-compare-bottom').addClass('is-fixed'); } } else { $('.c-compare-bottom').removeClass('is-fixed'); } if ($(window).scrollTop() > $('.c-hero-compare').offset().top + $('.c-hero-compare').outerHeight()) { if ($(window).scrollTop() > $('.c-compare').last().offset().top + $('.c-compare').last().outerHeight() + $('.c-compare-float__wrapper').outerHeight() + 500 - $(window).height()) { $('.c-compare-float__wrapper').removeClass('c-compare-float__wrapper--visible'); } else { $('.c-compare-float__wrapper').addClass('c-compare-float__wrapper--visible'); } } else { $('.c-compare-float__wrapper').removeClass('c-compare-float__wrapper--visible'); } // Search and type filter box if ($(window).scrollTop() > $('.compare-table thead tr:first-child').offset().top + $('.compare-table thead tr:first-child').outerHeight() - 150 && $(window).scrollTop() < $('.compare-table').offset().top + $('.compare-table').height() - $('#searchParameters').parent().height() - 150) { if ($(window).outerWidth() >= 992) { var adminBarHeight = $('#wpadminbar').length ? $('#wpadminbar').height() : 0; $('#searchParameters').parent().css('top', adminBarHeight + $('.c-header.is-fixed').height() + 'px'); $('#searchParameters').parent().css('width', $('#searchParameters').parent().outerWidth() + 'px'); $('#searchParameters').parent().css('bottom', ''); } else { $('#searchParameters').parent().css('width', ''); $('#searchParameters').parent().css('bottom', '0'); $('#searchParameters').parent().css('top', ''); } $('#searchParameters').parent().addClass('is-fixed'); } else { $('#searchParameters').parent().css('width', ''); $('#searchParameters').parent().css('bottom', ''); $('#searchParameters').parent().css('top', ''); $('#searchParameters').parent().removeClass('is-fixed'); } } }); /** * Cookiebanner */ var cookie = Cookies.get('WP-Cookie'); if (cookie !== '1') { $('.c-cookie').show(); } $('#accept').click(function () { Cookies.set('WP-Cookie', '1', { expires: 365 }); $('.c-cookie').hide(); }); /** * Accordion (Tabs) */ $('.c-accordion__tab-switch').on('click', function () { var tab_id = $(this).attr('data-tab'); $('.c-accordion__navigation .c-accordion__tab-switch').removeClass('c-accordion__tab-switch--active'); $(this).addClass('c-accordion__tab-switch--active'); $('.c-accordion__tab-content').removeClass('c-accordion__tab-content--active'); $('#' + tab_id).addClass('c-accordion__tab-content--active'); }); /** * subscribe form * */ $('.subscribe-button').click(function () { var $form = $(this).closest('form'), email = $form.find('[name="email"]').val(); if (email == '') { $('.subscribe-error').html('This is not a valid email address.'); return; } $.ajax({ method: 'POST', url: 'https://support.image-line.com/action/ajax/email-subscribe', data: { email: email }, success: function success(result) { var res = result.pop(); if (/sent/.test(res)) { $form.replaceWith('
' + res + '
'); } else { $('.subscribe-error').html(res); } } }); }); /** * Open accordion on page load */ $('#accordion-image-1, #accordion-text-1').html(function () { $(this).slideDown('slow'); $(this).prev('div').addClass('active'); }); $('.w-accordion-item-title').click(function () { $('.active').removeClass('active'); $(this).addClass('active'); var tab_id = $(this).attr('data-tab'); var image = $('#accordion-image-' + tab_id); //hides all other articles $('.w-accordion-media-image').not(image).slideUp(); //toggles the clicked one image.slideDown('slow'); var content = $('#accordion-text-' + tab_id); //hides all other articles $('.w-accordion-item-content').not(content).slideUp(); //toggles the clicked one content.slideDown('slow'); }); /** * Colored last words */ $('.c-colored-title').html(function () { var content = $(this).text().trim().split(' '); var lastWord = content.pop(); return content.join(' ') + (content.length > 0 ? ' ' + lastWord + '' : lastWord); }); /** * Video play button for quotes slider */ $('.c-video-poster').on('click', function (e) { e.preventDefault(); $(this).addClass('c-video-poster--hidden'); var iframe = $(this).next('iframe')[0]; iframe.src = iframe.dataset.src; iframe.src += '&autoplay=1'; }); /** * Compare button */ $('.c-compare__button').on('click', function () { $(this).parents('.row').toggleClass('row--open'); }); /** * Compare cat button */ $('.c-compare__cat').on('click', function () { var cat_id = $(this).data('cat-id'); $(this).parents('.row').toggleClass('row--open'); $(this).toggleClass('c-compare__cat--open'); $.each($('.c-compare__plugin-row'), function () { if ($(this).data('cat-id') === cat_id) { $(this).toggleClass('d-none'); } }); }); /** * Owned / not owned checkboxes */ var plugin_owned = $('#plugin_owned'); var plugin_not_owned = $('#plugin_not_owned'); var plugin_free_selection = $('#plugin_free_selection'); // Owned plugin_owned.on('change', applyFilters); // Not Owned plugin_not_owned.on('change', applyFilters); // Free Selection plugin_free_selection.on('change', applyFilters); function applyFilters() { // Reset everything to visible $('.c-product--owned, .c-product--not-owned').each(function () { $(this).parent('.c-product__wrapper').removeClass('d-none'); }); if ($(plugin_not_owned).is(':checked')) { // If Owned is not checked (if both are checked, no filtering needs to be done) if (!plugin_owned.is(':checked') && !plugin_free_selection.is(':checked')) { $('.c-product--owned').each(function () { $(this).parent('.c-product__wrapper').addClass('d-none'); }); } else if (!plugin_owned.is(':checked') && plugin_free_selection.is(':checked')) { $('.c-product--owned').each(function () { $(this).parent('.c-product__wrapper:not(.c_product--free-selection)').addClass('d-none'); }); } } else { if (plugin_owned.is(':checked')) { $('.c-product--owned').each(function () { $(this).parent('.c-product__wrapper').removeClass('d-none'); }); if (!plugin_free_selection.is(':checked')) { $('.c-product--not-owned').each(function () { $(this).parent('.c-product__wrapper').addClass('d-none'); }); } else { $('.c-product--not-owned:not(.c_product--free-selection)').each(function () { $(this).parent('.c-product__wrapper').addClass('d-none'); }); } } else if (plugin_free_selection.is(':checked')) { $('.c_product--free-selection').each(function () { $(this).parent('.c-product__wrapper').removeClass('d-none'); }); $('.c-product--owned:not(.c_product--free-selection)').each(function () { $(this).parent('.c-product__wrapper').addClass('d-none'); }); $('.c-product--not-owned:not(.c_product--free-selection)').each(function () { $(this).parent('.c-product__wrapper').addClass('d-none'); }); } } } /** * Distributor country */ $('.js-distributor').on('click', function () { var countryID = $(this).data('id') + ''; var distributors = []; $('.c-distributor').each(function () { $(this).removeClass('c-distributor--active'); var distributorID = $(this).data('id') + ''; if (distributorID.indexOf(countryID) >= 0) { $(this).addClass('c-distributor--active'); $(this).find('.c-distributor__list--buttons').find('.btn').removeClass('btn-primary').addClass('btn-dark'); // Get all distributors where countryID occurs distributors.push(distributorID.split(',')); } }); var target = $('.c-distributor[data-id="' + distributors[0] + '"]'); var $target = $(target); $('html, body').animate({ scrollTop: $target.offset().top }, 800); }); // Ajax LoadMore $(".c-load-more").click(function () { var btnLoadMore = $(this); $(btnLoadMore).addClass('disabled').blur(); var totalPosts = parseInt($('.c-load-more').attr('total_posts')); var offsetPosts = parseInt($('.c-load-more').attr('offset_posts')); var postsPerPage = parseInt($('.c-load-more').attr('posts_per_page')); var postType = $('.c-load-more').attr('post_type'); var tag = $('.c-load-more').attr('tag'); var data = { 'action': 'load_more_posts', 'offsetPosts': offsetPosts }; if (tag != '') { data['tag'] = parseInt(tag); } data['post_type'] = postType; $.ajax({ url: vars['ajaxurl'], data: data, type: 'POST', beforeSend: function beforeSend() {}, success: function success(data) { offsetPosts = offsetPosts + postsPerPage; $('.c-load-more').attr('offset_posts', offsetPosts); $('.load-more-container').append(data); if (offsetPosts >= totalPosts) { $('.c-load-more').remove(); } else { $(btnLoadMore).removeClass('disabled'); } } }); }); var offsetPostsVisible = 0; // Scroll-top button $(window).scroll(function () { var scroll = $(window).scrollTop(); if (scroll >= 400) { $('.c-back-top').addClass('in-view'); } else { $('.c-back-top').removeClass('in-view'); } if ($('.c-load-more').length > 0) { if (isIntoView($('.c-load-more')) && parseInt($('.c-load-more').attr('offset_posts')) != offsetPostsVisible) { $('.c-load-more').click(); offsetPostsVisible = parseInt($('.c-load-more').attr('offset_posts')); } } }); $('.c-back-top').click(function () { $('html, body').animate({ scrollTop: 0 }, 500); return false; }); // forum visitors, home page if (document.querySelector('.countMembers') !== null) { $.ajax({ type: "GET", url: "xml/forum_stats.xml", cache: false, dataType: "xml", success: function success(xml) { var i = 0; $(xml).find("forum_stats").children().each(function () { if (i++ < 3) $("." + this.nodeName).attr("data-to", $(this).text());else if (this.nodeName == "news") {} else if (this.nodeName == "popular_topics") {} else $("." + this.nodeName).html($(this).text()); }); if (isIntoView($('.countMembers'))) { animateInfo(); } else { $(window).scroll(function () { if (isIntoView($('.countMembers'))) { animateInfo(); } }); } } }); } // installers data, downloads page if (document.querySelector('.c-hero-download') !== null) { window.get_version_info_res = null; il_get_version_info(); var load = setInterval(function () { if (window.get_version_info_res !== null) { clearInterval(load); window.get_version_info_res = JSON.parse(window.get_version_info_res); var prodInfo = window.get_version_info_res.prod[Object.keys(window.get_version_info_res.prod)]; $('#win_ver').html(prodInfo.pc.version); $('#size_win_bytes').html(parseFloat(prodInfo.pc.size).toLocaleString('bg-BG') + ' bytes '); $('#size_win').prepend(prodInfo.pc.size_humans); $('#checksum_win').html(prodInfo.pc.checksum); $('#mac_ver').html(prodInfo.mac.version); $('#size_mac_bytes').html(parseFloat(prodInfo.mac.size).toLocaleString('bg-BG') + ' bytes '); $('#size_mac').prepend(prodInfo.mac.size_humans); $('#checksum_mac').html(prodInfo.mac.checksum); } }, 500); } }); /** * Lazyload videos */ document.addEventListener('DOMContentLoaded', function () { // Only execute on "desktop sized" screens if (document.body.clientWidth >= 1200) { var lazyVideos = [].slice.call(document.querySelectorAll('video.lazy')); lazyVideos.forEach(function (lazyVideo) { //console.table(lazyVideo.target); for (var source in lazyVideo.children) { var videoSource = lazyVideo.children[source]; if (typeof videoSource.tagName === 'string' && videoSource.tagName === 'SOURCE') { videoSource.src = videoSource.dataset.src; } } lazyVideo.load(); lazyVideo.classList.remove('lazy'); document.querySelector('.c-hero-home').classList.add('c-hero-home--video-loaded'); }); } }); /** * Add to cart onclick */ if (document.querySelector('.js-add-to-cart') !== null) { document.querySelector('.js-add-to-cart').addEventListener('click', function (e) { // Do not redirect to new page before pushing the datalayer e.preventDefault(); var productData = this.dataset; var href = this.href; var usedCurrency = "EUR"; var productPrice = ""; waitForCheckLoginRes(); function checkPricing(data) { return data.cart_currency; } function waitForCheckLoginRes() { if (typeof check_login_res !== 'undefined') { var accountInfo = check_login_res; if (accountInfo) { var usedCurrency = checkPricing(accountInfo); } else { console.log('check_login_res is undefined'); } } else { setTimeout(waitForCheckLoginRes, 250); } } if (usedCurrency === "EUR") { productPrice = productData.producteur; } else { productPrice = productData.productusd; } dataLayer.push({ 'event': 'addToCart', 'ecommerce': { 'currencyCode': usedCurrency, 'add': { 'products': [{ 'id': productData.productid, 'name': productData.producttitle, 'price': productPrice, 'brand': productData.productbrand, 'category': productData.productcategory, 'quantity': 1 }] } } }); // After everything is pushed, redirect to new page window.location = href; }); } //animate members function tos(t) { return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); } function animateSection(t, e, i) { function n() { a = tos(r), o.innerHTML = a, r += c, r > l && (o.innerHTML = tos(l), window.clearInterval(u)); } var o = document.querySelector(t), r = i, a = void 0, l = o.dataset.to, c = Math.ceil((l - i) / e * 5), u = window.setInterval(n, 5); } function animateInfo() { animateSection(".countMembers", 2400, 1e5); animateSection(".countTopics", 3e3, 1e5); animateSection(".countPosts", 3600, 1e6); $(window).unbind('scroll'); } function isIntoView(elem) { var documentViewTop = $(window).scrollTop(); var documentViewBottom = documentViewTop + $(window).height(); var elementTop = $(elem).offset().top; var elementBottom = elementTop + $(elem).height(); return elementBottom <= documentViewBottom && elementTop >= documentViewTop; } /** *extra search (x_search) */ (function (jQuery) { $.fn.livesearch = function (options) { var defaults = { lives_type: 'shop' }, settings = $.extend({}, defaults, options); var searcher = $(this); var searcherFrm = searcher.parents("form"); var searchId = 'sid' + Math.floor(Math.random() * 999999); searcher.attr("autocomplete", "off"); if ($("#live_results").length > 0) $("#live_results").append('');else { var results = ''; searcherFrm.parent().append(results); } searcherFrm.submit(function (e) { if (searcher.val().trim() != '') doneTyping('category_search'); e.preventDefault(); }); //setup before functions //timer identifier var typingTimer; //time in ms var doneTypingInterval = 300; var hovSearch = false; var searchQ = ''; var lastSearch = ''; var qR = ''; var q = ''; searcher.keyup(function () { clearTimeout(typingTimer); typingTimer = setTimeout(doneTyping, doneTypingInterval); }); //on keydown, clear the countdown searcher.keydown(function () { clearTimeout(typingTimer); }); //user is "finished typing," do something function doneTyping(search_type) { search_type = typeof search_type !== 'undefined' ? search_type : ''; q = searcher.val().trim(); searchQ = searcherFrm.serialize(); qR = searchQ.replace(/\+/g, ''); if ($.trim(q).length < 2) $('#' + searchId).html("").hide();else if (qR != lastSearch || search_type != '') { lastSearch = qR; $.ajax({ url: searcherFrm.attr("action") + searchQ + "&action=search&x=1&api=1&style=0" + (search_type != '' ? '&' + search_type + '=1' : '') + '&livesearch_id=' + searchId.replace('sid', '') }).done(function (data) { data = $(data); data.find('.result_head a').attr('target', '_blank').prop("onclick", null).off("click"); $('#' + searchId).html(data).show(); $("#os_list").show(); $("#livesearch_link" + searchId.replace('sid', '')).on("click", function () { search_type_1 = $(this).attr("data-stype").trim(); doneTyping(search_type_1 == 'product_search' ? search_type_1 : 'category_search'); }); }); } } searcher.blur(function () { if (!hovSearch) $('#' + searchId).hide(); }); searcher.focus(function () { $('#' + searchId).show(); }); $('#' + searchId + ',.filters_area').hover(function () { hovSearch = true; }, function () { hovSearch = false; }); $(".c-search__form input:checkbox").click(function () { if (searcher.val().trim() != '') doneTyping('category_search'); }); }; })(jQuery); function ealert(msg, btn, h, is_iframe, custom_class) { is_iframe = is_iframe != undefined ? is_iframe : false; custom_class = custom_class != undefined ? custom_class : ''; if (typeof btn === "undefined") btn = 'OK'; h = typeof h === "undefined" ? 500 : h + 105; $('body').append('
×
Loading...
' + msg + '
' + btn + '
').addClass('ealert_body'); setTimeout(function () { var new_h = $(".emBody").outerHeight() + $(".emFooter").outerHeight(); $('.emDlg').height(h > new_h && new_h > 0 ? new_h : h); }, 1); $('.emd-close').click(function (e) { $('.emd').remove(); $('body').removeClass('ealert_body'); }); }