Файловый менеджер - Редактировать - /home/digitalm/www/zetaworks/wp-content/themes/uncode/library/js/justifiedGalleryInit.js
Назад
(function($) { "use strict"; UNCODE.justifiedGallery = function() { var breakPointMe = function( val ) { val = parseInt( val ); if ( isNaN(val) ) { return false; } if ( val >= 1500 ) { return 1; } else if ( val < 1500 && val >= 960 ) { return 2; } else if ( val < 960 && val >= 570 ) { return 3; } else if ( val < 570 ) { return 4; } } var gutterByBreakpoint = function( bp, gutter ) { var ret; switch(gutter) { case 'no-gutter': ret = 0; break; case 'px-gutter': ret = 1; break; case 'half-gutter': ret = 18; break; case 'double-gutter': switch(bp) { case 3: case 4: ret = 36; break; default: ret = 72; break; } break; case 'triple-gutter': switch(bp) { case 3: case 4: ret = 36; break; default: ret = 108; break; } break; case 'quad-gutter': switch(bp) { case 2: ret = 108; break; case 3: ret = 72; break; case 4: ret = 36; break; default: ret = 144; break; } break; default: ret = 36;//single-gutter } return ret; } if ($('.justified-layout').length > 0) { var justifiedContainersArray = [], typeGridArray = [], layoutGridArray = [], transitionDuration = [], $filterItems = [], $filters = $('.justified-system .isotope-filters'), $itemSelector = '.tmb', $items, itemMargin, correctionFactor = 0, firstLoad = true, isOriginLeft = $('body').hasClass('rtl') ? false : true, prevW = breakPointMe(UNCODE.wwidth); $('[class*="justified-container"]').each(function() { var isoData = $(this).data(); transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); if (isoData.type == 'metro') typeGridArray.push(true); else typeGridArray.push(false); if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); else layoutGridArray.push('justified'); justifiedContainersArray.push($(this)); }); var init_justifiedGallery = function() { for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), justifiedId = justifiedSystem.attr('id'), $layoutMode = layoutGridArray[i], gutter = $(justifiedContainersArray[i]).data('gutter'), rowHeight = $(justifiedContainersArray[i]).data('row-height'), maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), lastRow = $(justifiedContainersArray[i]).data('last-row'), margins; rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; margins = gutterByBreakpoint(prevW, gutter); $(justifiedContainersArray[i]).justifiedGallery({ rowHeight: rowHeight, maxRowHeight: maxRowHeight, margins: margins, cssAnimation: true, lastRow: lastRow, waitThumbnailsLoad: false }).one('jg.complete', function(){ onLayout($(this), 0); } ); } }, onLayout = function(justifiedObj, startIndex) { justifiedObj.css('opacity', 1); justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); $('.tmb', justifiedObj).addClass('justified-object-loaded'); requestTimeout(function() { // window.dispatchEvent(UNCODE.boxEvent); UNCODE.adaptive(); if (SiteParameters.dynamic_srcset_active === '1') { UNCODE.refresh_dynamic_srcset_size(justifiedObj); } $(justifiedObj).find('audio,video').each(function() { $(this).mediaelementplayer({ pauseOtherPlayers: false, }); }); if ($(justifiedObj).find('.nested-carousel').length) { if (typeof UNCODE.carousel !== 'undefined') { UNCODE.carousel($(justifiedObj).find('.nested-carousel')); } requestTimeout(function() { boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); justifiedObj.addClass('justified-gallery-finished') Waypoint.refreshAll(); }, 200); } else { requestTimeout(function() { boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); justifiedObj.addClass('justified-gallery-finished') Waypoint.refreshAll(); }, 300); } }, 100); }, boxAnimation = function(items, startIndex, sequential, container) { var $allItems = items.length - startIndex, showed = 0, index = 0; if (container.closest('.owl-item').length == 1) return false; $.each(items, function(index, val) { var elInner = $('> .t-inside', val); if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { return; } if (val[0]) val = val[0]; if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { new Waypoint({ context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, element: val, handler: function() { var element = $('> .t-inside', this.element), parent = $(this.element), currentIndex = parent.index(); var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), delayAttr = parseInt(element.attr('data-delay')); if (isNaN(delayAttr)) delayAttr = 100; delay -= showed; var objTimeout = requestTimeout(function() { element.removeClass('zoom-reverse').addClass('start_animation'); showed = parent.index(); }, delay * delayAttr); parent.data('objTimeout', objTimeout); if (!UNCODE.isUnmodalOpen) { this.destroy(); } }, offset: '100%' }) } else { elInner.removeClass('animate_when_almost_visible'); $(val).addClass('no-waypoint-animation'); /*if (elInner.hasClass('force-anim')) { elInner.addClass('start_animation'); } else { elInner.css('opacity', 1); }*/ } index++; }); }; $filters.on('click', 'a[data-filter]', function(evt) { var $filter = $(this), filterContainer = $filter.closest('.isotope-filters'), filterValue = $filter.attr('data-filter'), container = $filter.closest('.justified-system').find($('.justified-layout')), lastRow = container.data('last-row'), transitionDuration = 0, delay = 300, filterItems = []; lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; if (!$filter.hasClass('active')) { /** Scroll top with filtering */ if (filterContainer.hasClass('filter-scroll')) { var calc_scroll = container.closest('.uncol').offset().top, getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0, getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0, filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0; filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0; calc_scroll -= filterOffset - 1; calc_scroll -= UNCODE.get_scroll_offset(); var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], delta = bodyTop - calc_scroll, scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; if ( !UNCODE.isFullPage ) { if (scrollSpeed == 0) { $('html, body').scrollTop(calc_scroll); UNCODE.scrolling = false; } else { $('html, body').animate({ scrollTop: calc_scroll },{ easing: 'easeInOutQuad', duration: scrollSpeed, complete: function(){ UNCODE.scrolling = false; } }); } } } if (filterValue !== undefined) { $.each($('> .tmb > .t-inside', container), function(index, val) { var parent = $(val).parent(), objTimeout = parent.data('objTimeout'); if (objTimeout) { $(val).removeClass('zoom-reverse'); clearRequestTimeout(objTimeout); } if (transitionDuration == 0) { if ($(val).hasClass('animate_when_almost_visible')) { $(val).addClass('zoom-reverse').removeClass('start_animation'); } else { $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); } } }); requestTimeout(function() { var $block, selector, lightboxElements, $boxes; if ( filterValue !== '' && filterValue !== '*' ) { $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); selector = '.' + filterValue; $.each($(selector, container), function(index, block) { lightboxElements = $('[data-lbox^=ilightbox]', block); if (lightboxElements.length) { lightboxElements.removeClass('lb-disabled'); container.data('lbox', $(lightboxElements[0]).data('lbox')); } filterItems.push(block); }); container.justifiedGallery({ filter: selector, lastRow: 'nojustify' }); } else { container.justifiedGallery({ filter: false, lastRow: lastRow }); $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); filterItems = $('> .tmb', container); } $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); if (typeof UNCODE.lightbox !== 'undefined') { var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; if (typeof getLightbox === 'object') getLightbox.refresh(); } if (transitionDuration == 0) { requestTimeout(function() { boxAnimation(filterItems, 0, false, container); }, 100); } requestTimeout(function() { Waypoint.refreshAll(); }, 2000); }, delay); } else { $.each($('> .tmb > .t-inside', container), function(index, val) { var parent = $(val).parent(), objTimeout = parent.data('objTimeout'); if (objTimeout) { $(val).removeClass('zoom-reverse').removeClass('start_animation') clearRequestTimeout(objTimeout); } if (transitionDuration == 0) { if ($(val).hasClass('animate_when_almost_visible')) { $(val).addClass('zoom-reverse').removeClass('start_animation'); } else { $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); } } }); container.parent().addClass('justified-loading'); } } evt.preventDefault(); }); $filters.each(function(i, buttonGroup) { var $buttonGroup = $(buttonGroup); $buttonGroup.on('click', 'a', function() { $buttonGroup.find('.active').removeClass('active'); $(this).addClass('active'); }); var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { e.preventDefault(); $cats_filters.slideToggle(400, 'easeInOutCirc'); }); }); window.addEventListener('boxResized', function(e) { if ( prevW !== breakPointMe(UNCODE.wwidth) ) { prevW = breakPointMe(UNCODE.wwidth); $.each($('.justified-layout'), function(index, val) { var gutter = $(this).data('gutter'), margins = gutterByBreakpoint( prevW, gutter); $(this).justifiedGallery({ margins: margins }); $(this).find('.mejs-video,.mejs-audio').each(function() { $(this).trigger('resize'); }); }); } }, false); init_justifiedGallery(); }; }; })(jQuery);
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Генерация страницы: 0.04 |
proxy
|
phpinfo
|
Настройка