$(document).ready(function(){ /* ====================== BUILDING ====================== */ $('.top-carousel').owlCarousel({ loop:false, rewind:true, dots:false, autoplay:false, autoplayTimeout:12000, nav:true, margin:20, navText:['',''], responsive: {0: {items:3, slideBy:2, dots:false, nav:true, margin:10}, 470: {items:4, slideBy:2, dots:false, nav:true}, 760: {items:5, slideBy:2, dots:false, nav:true}, 950: {items:6, slideBy:2, dots:false, nav:true}, 1220: {items:8, slideBy:2, dots:false, nav:true, margin:20}}, lazyLoad: false, onInitialized: callback, onTranslate: callback }); function callback(event) { setTimeout(function() { $(window).lazyLoadXT(); }, 300); }; $('#owl-posters').each(function(){ var relItem = $(this).find('.poster-item'), relGroup = 3, relArr = relItem; for(i = 0; i < relItem.length; i += relGroup){ $(relArr.slice(i,i+relGroup)).wrapAll('
'); }; $(this).before(''); }); $('#owl-posters').owlCarousel({ loop:false, rewind:true, dots:false, autoplay:false, autoplayTimeout:12000, nav:true, margin:0, navText:['',''], items: 1, lazyLoad: false, onInitialized: callback, onTranslate: callback }); $('.posters-nav .owl-next').click(function() { $('#owl-posters').trigger('next.owl.carousel'); }); $('.posters-nav .owl-prev').click(function() { $('#owl-posters').trigger('prev.owl.carousel'); }); $('#owl-related').owlCarousel({ loop:false, rewind:true, dots:false, autoplay:false, autoplayTimeout:12000, nav:true, margin:20, navText:['',''], responsive: {0: {items:3, slideBy:2, dots:false, nav:true, margin:10}, 470: {items:4, slideBy:2, dots:false, nav:true}, 760: {items:5, slideBy:2, dots:false, nav:true}, 950: {items:5, slideBy:2, dots:false, nav:true}, 1220: {items:5, slideBy:2, dots:false, nav:true, margin:20}}, lazyLoad: false, onInitialized: callback, onTranslate: callback }); $('.tabs').each(function(){ $(this).find('.tabs__select div:first').addClass('is-active'); $(this).find('.tabs__content:first').removeClass('d-none'); }); $('.tabs__select').on('click', 'div:not(.is-active)', function() { $(this).addClass('is-active').siblings().removeClass('is-active') .closest('.tabs').find('.tabs__content').hide().eq($(this).index()).fadeIn(0); setTimeout(function() { $(window).lazyLoadXT(); }, 300); }); $('body').append(' '); $('.js-this-in-mobile-menu').each(function() { $(this).clone().appendTo('#mobile-menu'); }); /* ====================== EVENTS ====================== */ $(document).on('click','.nav__btn',function(){ $(this).parent().toggleClass('is-active').children('.nav__hidden').slideToggle(200); $(this).toggleClass('is-active'); }); $(document).on('click','.js-toggle-search',function(){ $('.header__search').slideToggle(200); $(this).toggleClass('is-active').find('.fal').toggleClass('fa-search fa-times'); }); $(document).on('click','.js-show-login',function(){ $('.overlay, .login').fadeIn(200); $('body').addClass('modal-is-opened'); setTimeout(function() { $(window).lazyLoadXT(); }, 300); return false; }); $(document).on('click','.pagination__btn-loader a',function(){ var urlNext = $(this).attr('href'), scrollNext = $(this).offset().top; if (urlNext !== undefined) { $.ajax({ url: urlNext, beforeSend: function() { ShowLoading('Загрузка.
Пожалуйста, подождите.'); }, success: function(data) { $('#pagination').remove(); $('#dle-content').append($('#dle-content', data).html()); window.history.pushState("", "", urlNext); $('html, body').animate({scrollTop:scrollNext}, 800); $('.pagination__btn-loader span').text('Больше нет новостей'); HideLoading(''); setTimeout(function() { $(window).lazyLoadXT(); }, 300); }, error: function() { HideLoading(''); alert('что-то пошло не так'); } }); }; return false; }); $('body').on('click','.js-show-trailer',function(){ $("#page__trailer").dialog({ modal: true, show: 'fade', hide: 'fade', width: 800, open: function( event, ui ) {setTimeout(function() { $(window).lazyLoadXT(); }, 300);}, close: function( event, ui ) {$(this).dialog('destroy')} }); }); $(".js-scrollto").click(function(){ var trg = $(this).attr('href'); $('html, body').animate({scrollTop:$(trg).offset().top - 60}, 800); return false; }); $(".js-show-mobile-menu").click(function(){ $('.overlay').fadeIn(200); $('#mobile-menu, .mobile-menu-close').addClass('is-active'); $('body').addClass('mobile-menu-is-opened'); }); $(document).on('click','.overlay, .login__close, .mobile-menu-close',function(){ $('.overlay, .login').fadeOut(200); $('#mobile-menu, .mobile-menu-close').removeClass('is-active'); $('body').removeClass('modal-is-opened mobile-menu-is-opened'); }); /* ====================== DLE SCRIPTS ====================== */ $(document).on('click','.form__textarea-inside textarea, .fr-wrapper',function(){ $('.add-comments-form').find('.form__row--protect').removeClass('d-none'); }); $('#dle-content > #dle-ajax-comments').appendTo($('#page__comments-list')); $('.login__social-btns a').on('click',function(){ var href = $(this).attr('href'), width = 820, height = 420, left = (screen.width - width)/2, top = (screen.height - height)/2-100; auth_window = window.open(href, 'auth_window', "width="+width+",height="+height+",top="+top+",left="+left+"menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no"); return false; }); $('.js-comm-author').each(function(){ var a = $(this), b = a.closest('.js-comm'), c = a.text().substr(0,1), f = b.find('.js-comm-avatar'), e = f.children('img').attr('src'), d = ["#c57c3b","#753bc5","#79c53b","#eb3b5a","#45aaf2","#2bcbba","#778ca3"], rand = Math.floor(Math.random() * d.length); if (e == '/templates/'+dle_skin+'/dleimages/noavatar.png') { f.html('