1/** 2* @author Amazzing 3* @copyright Amazzing 4* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)* 5*/ 6 7$(document).ready(function(){ 8 var ab_initialClasses = {}, 9 ab_carousels = {}, 10 ab_resizeTimer, 11 $currentPresentationItems = $('.presentation-preview.current'); 12 13 if ($currentPresentationItems.length) { 14 $('.presentation-preview').on('click', function(e){ 15 e.preventDefault(); 16 $(this).addClass('current').siblings().removeClass('current'); 17 var html = $(this).find('.full-content').html(); 18 $(this).closest('.block.presentation-view').find('.main-item').html(html); 19 }); 20 $currentPresentationItems.click(); 21 } 22 23 // normalize heights in grids 24 $('.item-list.grid').each(function(){ 25 ab_normalizeHeights($(this)); 26 }) 27 28 // prepare carousels 29 $('.item-list.carousel').each(function(){ 30 ab_renderCarousel($(this).closest('.block').data('id')); 31 }); 32 33 $(window).resize(function(){ 34 clearTimeout(ab_resizeTimer); 35 ab_resizeTimer = setTimeout(function() { 36 $('.ab.block').find('.carousel.rendered').removeClass('rendered'); 37 // reset item heights for normalizing 38 $('.ab.block').find('.normalized').removeClass('normalized'); 39 $('.ab.block').find('.post-item-title, .post-item-content').css('min-height', ''); 40 for (var id in ab_carousels) { 41 ab_renderCarousel(id); 42 } 43 }, 200); 44 }); 45 46 function ab_renderCarousel(id){ 47 var $block = $('.ab.block[data-id="'+id+'"]'), 48 $container = $block.find('.carousel'), 49 settings = $block.data('carousel-settings'), 50 w = $(window).width(), 51 itemsNum = 1; 52 if ($container.hasClass('rendered') || !settings) { 53 return; 54 } 55 $container.addClass('rendered'); 56 if (w > 1199) { 57 itemsNum = settings.i; 58 } else if (w > 991) { 59 itemsNum = settings.i_1200; 60 } else if (w > 767) { 61 itemsNum = settings.i_992; 62 } else if (w > 479) { 63 itemsNum = settings.i_768; 64 } else if (w < 480) { 65 itemsNum = settings.i_480; 66 } 67 68 var contanerWidth = $container.closest('.block').innerWidth(), 69 slideWidth = Math.round(contanerWidth / itemsNum); 70 71 settings.min_width = 100; 72 if (slideWidth < settings.min_width) { 73 itemsNum = parseInt(contanerWidth / settings.min_width); 74 slideWidth = parseInt(contanerWidth / itemsNum); 75 } 76 77 var params = { 78 pager : settings.p == 1 ? true : false, 79 controls: parseInt(settings.n) > 0 ? true : false, 80 auto: settings.a == 1 ? true : false, 81 moveSlides: 1, 82 speed: parseInt(settings.s), 83 maxSlides: itemsNum, 84 minSlides: itemsNum, 85 slideWidth: slideWidth, 86 responsive: false, 87 swipeThreshold: 1, 88 useCSS: true, 89 oneToOneTouch: false, 90 infiniteLoop: settings.l == 1 ? true : false, 91 nextText: '<i class="icon-chevron-right"></i>', 92 prevText: '<i class="icon-chevron-left"></i>', 93 onSliderLoad: function(){ 94 $container.attr('class', ab_initialClasses[id]+' items-num-'+itemsNum).closest('.bx-wrapper').css('max-width', '100%'); 95 ab_normalizeHeights($container); 96 var $productImageContainer = $container.find('.product-image-container').first(); 97 if ($productImageContainer.length) { 98 $container.closest('.bx-wrapper').find('.bx-prev, .bx-next').css('top', parseInt(($productImageContainer.outerHeight()/2) + 5)+'px'); 99 } 100 }, 101 onSlideBefore: function() { 102 $block.find('.bx-controls-direction').addClass('no-bg'); 103 }, 104 onSlideAfter: function() { 105 $block.find('.bx-controls-direction').removeClass('no-bg'); 106 } 107 }; 108 109 if (id in ab_carousels) 110 ab_carousels[id].reloadSlider(params); 111 else { 112 if (settings.n == 2 && !isMobile) { 113 $block.addClass('n-hover'); 114 } 115 ab_initialClasses[id] = $container.attr('class'); 116 ab_carousels[id] = $container.bxSlider(params); 117 } 118 } 119}); 120 121function ab_normalizeHeights($list) { 122 if ($list.hasClass('normalized')) { 123 return; 124 } 125 if ($list.hasClass('post-list')) { 126 var thMax = 0, 127 chMax = 0; 128 // temporary phantom item for normalizing the last row 129 $list.append('<div class="first-in-line phantom hidden"></div>'); 130 $list.children().each(function(){ 131 if ($(this).hasClass('first-in-line')) { 132 $(this).prevAll().not('.normalized').addClass('normalized') 133 .find('.post-item-title').css({'min-height': thMax+'px'}) 134 .siblings('.post-item-content').css({'min-height': chMax+'px'}); 135 thMax = 0; 136 chMax = 0; 137 if ($(this).hasClass('phantom')) { 138 $list.addClass('normalized'); 139 $(this).remove(); 140 } 141 } 142 var th = $(this).find('.post-item-title').outerHeight(); 143 thMax = th > thMax ? th : thMax; 144 var ch = $(this).find('.post-item-content').outerHeight(); 145 chMax = ch > chMax ? ch : chMax; 146 }); 147 } 148} 149/* since 1.3.0 */
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.