'use strict'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var initialize = ''; (function ($) { "use strict"; initialize = function initialize() { stm_unclickable(); stm_switcher(); stm_tabs(); stm_sticky_footer(); js_active_switch(); js_active_trigger(); stm_light_gallery(); stm_share_url(); stm_header_dropdown_mobile(); stm_header_dropdown_vertical_nav(); stm_header_dropdown_post_filter(); stm_header_dropdown_socials(); stm_select_style(); rowExpand(); stm_inputs_style(); titleBoxExpand(); closeMessageBox(); stm_load_posts(); stm_scroll_to(); stm_datepicker(); stm_timepicker(); stm_mobileStickyHeader(); stm_load_scripts(); stm_image_placeholder(); stm_scroll_top(); stm_scroll_to_top(); stm_post_thumbnail_before_content(); stm_post_archive_sidebars(); stm_post_video_hover(); stm_envato_preview_control(); set_fullwidth(); stm_audio_modal(); stm_stretch_column(); stm_kenburns(); productTabs(); }; $(document).ready(function () { initialize(); }); $(window).on('load', function () { stm_sticky_footer(); stm_site_prealoder(); titleBoxExpand(); set_fullwidth(); stm_hamburger(); }); $(window).resize(function () { stm_sticky_footer(); titleBoxExpand(); rowExpand(); stm_mobileStickyHeader(); stm_post_thumbnail_before_content(); set_fullwidth(); }); $(window).scroll(function () { if ($(".pearl_arrow_top").length) { var trigger_height = $(window).scrollTop() + $(window).height() + $('.stm-footer').height(); if (trigger_height > $(document).height()) { $(".pearl_arrow_top").addClass("arrowShow"); } if ($(window).scrollTop() === 0) { $(".pearl_arrow_top").removeClass("arrowShow"); } } }); if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { stm_animate_block(); } else { $(".stm_animation").css('opacity', 1); } jQuery(window).scroll(function () { if (!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { stm_animate_block(); } else { $(".stm_animation").css('opacity', 1); } }); function stm_animate_block() { jQuery('.stm_animation').each(function () { if (jQuery(this).attr('data-animate')) { var animation_blocks = jQuery(this).children('*'); var animationName = jQuery(this).attr('data-animate'), animationDuration = jQuery(this).attr('data-animation-duration') + 's', animationDelay = jQuery(this).attr('data-animation-delay'); var style = 'opacity:1;-webkit-animation-delay:' + animationDelay + 's;-webkit-animation-duration:' + animationDuration + '; -moz-animation-delay:' + animationDelay + 's;-moz-animation-duration:' + animationDuration + '; animation-delay:' + animationDelay + 's;'; var container_style = 'opacity:1;-webkit-transition-delay: ' + animationDelay + 's; -moz-transition-delay: ' + animationDelay + 's; transition-delay: ' + animationDelay + 's;'; if (isAppear(jQuery(this))) { jQuery(this).attr('style', container_style); jQuery.each(animation_blocks, function (index, value) { jQuery(this).attr('style', style); jQuery(this).addClass('animated').addClass(animationName); }); } } }); } function isAppear(id) { var window_scroll = jQuery(window).scrollTop(); var window_height = jQuery(window).height(); if (jQuery(id).hasClass('stm_viewport')) { var start_effect = jQuery(id).data('viewport_position'); } if (typeof start_effect === 'undefined' || start_effect == '') { var percentage = 2; } else { var percentage = 100 - start_effect; } var element_top = jQuery(id).offset().top; var position = element_top - window_scroll; var cut = window_height - window_height * (percentage / 100); if (position <= cut) { return true; } else { return false; } } function set_fullwidth() { var width = $(window).width(); var elements = ['.stm_slider_style_9 .owl-nav']; $.each(elements, function () { var $element = $(this); var stm_site_width_custom = $element.closest('.container').width(); if ($element.length) { var offset = (width - stm_site_width_custom) / 2; $element.css('margin-left', '-' + offset + 'px'); $element.width(width); } }); } function stm_unclickable() { $('body').on('click', '.unclickable', function (e) { e.preventDefault(); }); } function stm_switcher() { $('.stm-switcher__trigger').on('click', function () { $(this).closest('.stm-switcher').find('.stm-switcher__list').toggleClass('active'); $(this).toggleClass('active'); }); $('.stm-switcher__option').on('click', function () { var stm_switch = $(this).data('switch'); $(this).closest('.stm-switcher').parent().find('.js-switcher').addClass('js-switcher__hidden'); $(this).closest('.stm-switcher').parent().find('.js-switcher_' + stm_switch).removeClass('js-switcher__hidden'); $(this).closest('.stm-switcher').find('.stm-switcher__text').text($(this).text()); $(this).closest('.stm-switcher__list').removeClass('active'); $(this).closest('.stm-switcher').find('.stm-switcher__trigger').removeClass('active'); }); } function stm_sticky_footer() { var windowH = $(window).height(); var footerH = $('.stm-footer').outerHeight(); if ($('#wpadminbar').length) { footerH += $('#wpadminbar').outerHeight(); } $('#wrapper').css('min-height', windowH - footerH + 'px'); } function stm_tabs() { $("ul.nav-tabs > li > a").on("click", function (e) { var id = $(this).attr("href").substr(1); window.location.hash = id; }); var hash = window.location.hash; $('#products__tabs a[href="' + hash + '"]').tab('show'); } function js_active_switch() { $('.js_active_switcher .js_active_switcher__a').on('click', function (e) { e.preventDefault(); $(this).closest('.js_active_switcher').find('.js_active_switcher__a').removeClass('active'); $(this).addClass('active'); }); } function js_active_trigger() { var opened = false; var dataToggle = ''; var $element = ''; var $this = ''; $('.js_trigger__click').on('click', function (e) { e.preventDefault(); e.stopPropagation(); $this = $(this); dataToggle = $(this).attr('data-toggle'); if (typeof dataToggle == 'undefined') dataToggle = true; $element = $(this).closest('.js_trigger').find('.js_trigger__unit'); var element = $(this).attr('data-element'); if (typeof element !== 'undefined') $element = $(element); if (dataToggle && dataToggle !== 'false') { $element.slideToggle('fast'); } else { $element.toggleClass('active'); } $(this).toggleClass('active'); opened = $(this).hasClass('active') ? true : false; var view_ = $(this).attr('data-text-more'); var close_ = $(this).attr('data-text-close'); if (opened) { $(this).text(close_); } else { $(this).text(view_); } }); } function stm_share_url() { $('.stm_js__shareble a').on('click', function (e) { e.preventDefault(); var url = $(this).data('share'); var social = $(this).data('social') + '_share'; window.open(url, social, 'width=580,height=296'); }); } function stm_header_dropdown_mobile() { var windowW = $(window).width(); $('.stm_mobile__switcher').on('each', function (e) { if ($(this).hasClass('active')) { $(this).parent().addClass('href_empty'); } }); $('.stm-header .stm-navigation__default li:not(.menu-item-has-children) a').on('click', function (e) { $('.stm-header__overlay').removeClass('active'); $('.stm_mobile__header').removeClass('active'); $('.stm_mobile__switcher').removeClass('active'); $('.stm-header').removeClass('active'); $('body').removeClass('active'); }); $('.stm-navigation li.menu-item-has-children > a').each(function () { var href = $(this).attr("href"); if (href == "#") { $(this).parent().addClass('href_empty'); } $(this).append(''); }); $('.stm-navigation_hamburger_full li.menu-item-has-children > a > .stm_mobile__dropdown').each(function () { $(this).remove(); $('body').addClass('hamburger_full'); }); $('.stm-navigation_hamburger_full').find('.href_empty>a').on('click', function (e) { e.preventDefault(); e.stopPropagation(); var dd = $(this); dd.closest('li').toggleClass('active'); if (dd.parents('.navigation_hamburger_full').length === 0 || window.innerWidth < 1024) { dd.closest('li').children('.sub-menu').toggle(); } }); $('body').find('.stm_mobile__dropdown').on('click', function (e) { e.preventDefault(); e.stopPropagation(); var dd = $(this); dd.closest('li').toggleClass('active'); }); if (typeof $.fn.swipe === 'function' && windowW < 992) { $(".stm-header").swipe({ swipe: function swipe(event, direction, distance, duration, fingerCount, fingerData) { if (direction == 'left' && distance > 50) { $('.stm-header').removeClass('active'); $('.stm-header__overlay').removeClass('active'); $('.stm_mobile__header').removeClass('active'); $('.stm_mobile__switcher').removeClass('active'); } }, allowPageScroll: "vertical" }); } $('.stm-header__overlay').on('click', function () { $(this).removeClass('active'); $('.stm_mobile__header').removeClass('active'); $('.stm_mobile__switcher').removeClass('active'); $('.stm-header').removeClass('active'); $('body').removeClass('active'); }); } function stm_header_dropdown_vertical_nav() { $('.stm-header .stm-navigation__vertical_left li.menu-item-has-children').on('click', function (e) { if (!$(this).hasClass('active')) { $('.stm-header .stm-navigation__vertical_left li.menu-item-has-children.active').removeClass('active'); $(this).addClass('active'); } else { $('.stm-header .stm-navigation__vertical_left li.menu-item-has-children.active').removeClass('active'); } }); $('.stm-header .stm-navigation__vertical_left .stm_mobile__switcher').on('click', function (e) { $('.stm-navigation__vertical').toggleClass('active'); }); } function stm_header_dropdown_post_filter() { $('.stm-header .stm-post-filter .stm_mobile__switcher').on('click', function () { $('.stm-header .stm-socials-hidden').removeClass('active'); $(this).parents().find('.post-filter').each(function () { if ($(this).hasClass('active')) { $(this).removeClass('active'); } else { $(this).addClass('active'); } }); }); } function stm_header_dropdown_socials() { $('.stm-header .stm-socials-hidden .stm-socials-btn').on('click', function () { $('.stm-header .post-filter').removeClass('active'); $('.stm-header .stm_mobile__switcher').removeClass('active'); $(this).parents().find('.stm-socials-hidden').each(function () { if ($(this).hasClass('active')) { $('.stm-socials-btn').removeClass('active'); $(this).removeClass('active'); } else { $('.stm-socials-btn').addClass('active'); $(this).addClass('active'); } }); }); } function stm_site_prealoder() { if ($('html').hasClass('stm-site-loader')) { $('html').addClass('loaded'); var prevent = false; $('a[href^=mailto], a[href^=skype], a[href^=tel]').on('click', function (e) { prevent = true; $('html').addClass('loaded'); }); $(window).on('beforeunload', function (e, k) { if (!prevent) { $('html').removeClass('loaded'); } else { prevent = false; } }); } } function productTabs() { $('#products__tab .mobile_tab a').on('click', function (e) { var target = $(this).attr("href"); $('body, html').css('transition-delay', '0s'); setTimeout(function () { $('body, html').animate({ scrollTop: $(target).offset().top }, 100); }, 10); }); } function titleBoxExpand() { var box = $('.stm_titlebox'); var container = box.parents('.container'); if (box.length === 0 || container.length === 0) { return; } var ww = $(document).width() - stm_site_paddings * 2; var w = container.width(); var offset = (ww - w) * 0.5; box.css({ width: ww, 'margin-left': '-' + offset + 'px' }); } var rowExpand = function rowExpand() { var sidebarEnabled = $('.site-content .stm_markup__sidebar').length > 0; var forceContainer = $('.site-content .vc_container-fluid-force').length > 0; if (sidebarEnabled && !forceContainer) { return; } $('.stm_markup__content .vc_container-fluid, .vc_container-fluid-force').each(function () { var row = $(this); var container = row.parents('.container'); if (row.length === 0 || container.length === 0) { return; } var ww = $(document).width() - stm_site_paddings * 2; var w = container.width(); var margin = $(this).attr('data-margin'); if (typeof margin === 'undefined') margin = 0; var offset = (ww - w) * 0.5 - margin; row.css({ width: ww - margin * 2, 'margin-left': '-' + offset + 'px' }); var position = $(this).offset().left; if (position != stm_site_paddings && stm_site_paddings > position) { offset = offset - (stm_site_paddings - position); row.css({ 'margin-left': '-' + offset + 'px' }); } }); }; function closeMessageBox() { $('body').on('click', '.vc_message_box .close', function (e) { e.preventDefault(); var messageBox = $(this).parents('.vc_message_box'); messageBox.fadeOut(300, function () { $(this).remove(); }); }); } $.fn.is_on_screen = function () { var win = $(window); var viewport = { top: win.scrollTop(), left: win.scrollLeft() }; viewport.right = viewport.left + win.width(); viewport.bottom = viewport.top + win.height(); var bounds = this.offset(); bounds.right = bounds.left + this.outerWidth(); bounds.bottom = bounds.top + this.outerHeight(); return !(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom); }; var stm_select_style = function stm_select_style() { var select = $('select').not('.no_wrap, [multiple], [data-attribute_name], .woocommerce select, [data-field-id]'); select.each(function () { var select = $(this); var options = select.find('option'); var values = []; options.each(function (v, k) { values.push($(k).text()); }); var choicesList = ''; var wrapperStructure = '
'; var wrapper = select.wrap(wrapperStructure).parent(); var selectVal = $('').appendTo(wrapper); choicesList = $(choicesList).appendTo(wrapper); choicesList.find('li').on('click', function (e) { e.stopPropagation(); var choice = $(this).text(); selectVal.text(choice); select.val(choice); select.find('option').remove(); select.append('