function loadGifImage(x){ "use strict"; try{ if(!x.parentNode.className.match(/\bcanopus-gif-container\b/)){ var wrapper = document.createElement('div'); wrapper.className = 'canopus-gif-container'; wrapper.style.backgroundImage = "url('"+x.src+"')"; x.setAttribute('rel:animated_src',x.dataset.animated_src); wrapper.appendChild(x.cloneNode(true)); x.parentNode.replaceChild(wrapper, x); } }catch(e){} } function strtm_owl(){ "use strict"; var $=jQuery; // OwlCarousel if ($().owlCarousel !== undefined && $().owlCarousel !== 'undefined') { $('.strtm-slider').each(function () { var $owl = $('.owl-carousel', $(this)); var $refreshed = true; var $margin = 0; var $smartSpeed = 800; var $mouseDrag = false; var $marginRes = 0; var $autoWidth = false; var $singleItem = true; var $loop = true; var $items = 1; var $itemRes0 = 1; var $itemRes768 = 1; var $itemRes960 = 1; var $slAuto = canopus_script_data.slider_auto; var $slDelay = canopus_script_data.slider_delay; if ($(this).hasClass('slider3')) { $loop = false; $singleItem = false; $items = 2; $margin = 30; $itemRes0 = 1; $itemRes768 = 2; $itemRes960 = 3; $smartSpeed = 1000; $mouseDrag = true; $marginRes = 20; $autoWidth = true; var $marginDef = $margin; var $width = $owl.width(); var $widthS = 0; var $widthL = 0; } $owl.owlCarousel({ singleItem: $singleItem, navText: ["", ""], nav: true, dots: false, autoplay: $slAuto, autoplayTimeout: $slDelay, margin: $margin, smartSpeed: $smartSpeed, mouseDrag: $mouseDrag, autoWidth: $autoWidth, fallbackEasing: 'linear', loop: $loop, items: $items, responsive: { 0: { items: $itemRes0, margin: $marginRes }, 768: { items: $itemRes768, margin: $marginRes }, 960: { items: $itemRes960, margin: $marginRes }, 1200: { items: $items } } }); /* Important After $owl.owlCarousel(); */ if ($(this).hasClass('slider3')) { $owl.on('refresh.owl.carousel', function () { $owl.removeClass('slider3-trans'); $refreshed = true; $width = $owl.width(); $margin = window.matchMedia('(max-width: 1199px)').matches ? $marginRes : $marginDef; if (window.matchMedia('(max-width: 991px)').matches) { $widthS = parseInt(($width - $margin) / 2, 10); $widthL = $width; } else { $widthS = parseInt(($width - 2 * $margin) / 3, 10); $widthL = $width - $widthS - $margin; } $('.slider-item', $owl).width($widthS); $('.slider-item', $owl).last().width($width); $('.owl-item', $owl).removeClass('owl-item-large').removeClass('owl-item-small'); var $large = $('.owl-item.active', $owl).first().addClass('owl-item-large'); if ($large.next('.owl-item').length) { $large.next('.owl-item').addClass('owl-item-small'); } setTimeout(function () { $refreshed = false; $large.siblings('.owl-item').children('.slider-item').width($widthS); $large.children('.slider-item').width($widthL); setTimeout(function () {$owl.addClass('slider3-trans');}, 100); }, 100); }); $owl.on('changed.owl.carousel', function (e) { $width = $owl.width(); $margin = window.matchMedia('(max-width: 1199px)').matches ? $marginRes : $marginDef; var $dif=2; if (window.matchMedia('(max-width: 991px)').matches) { $dif=1; $widthS = parseInt(($width - $margin) / 2, 10); $widthL = $width; } else { $widthS = parseInt(($width - 2 * $margin) / 3, 10); $widthL = $width - $widthS - $margin; } $('.slider-item', $owl).width($widthS); $('.slider-item', $owl).last().width($width); if ($refreshed) { $refreshed = false; } else { $('.owl-item', $owl).removeClass('owl-item-large').removeClass('owl-item-small'); var $large = $('.owl-item', $owl).eq(e.item.index).addClass('owl-item-large'); if ($large.next('.owl-item').length) { $large.next('.owl-item').addClass('owl-item-small'); } $large.children('.slider-item').width($widthL); $large.siblings('.owl-item').children('.slider-item').width($widthS); } setTimeout(function(){ if($('.owl-item', $owl).length>$dif){ if($('.owl-nav', $owl).length){ $('.owl-nav', $owl).removeClass('disabled'); } if($('.owl-item.active', $owl).length>$dif){ $('.owl-next', $owl).removeClass('disabled'); } } },100); }); $owl.trigger('refresh.owl.carousel'); } $owl.on('translate.owl.carousel', function () { $owl.addClass('sliding'); }); $owl.on('translated.owl.carousel', function () { $owl.removeClass('sliding'); }); }); $('.instagram-pics.owl-carousel').each(function () { var $cOwl = $(this); var $singleItem = $cOwl.closest('.strtm-instagram').hasClass('strtm-instagram') ? false : true; var $items = $cOwl.closest('.strtm-instagram').hasClass('strtm-instagram') ? ($('body').hasClass('theme-boxed') ? 5 : 8) : 1; var $pagination = $cOwl.closest('.sidebar-area').hasClass('sidebar-area') ? true : false; var $autoPlay = $cOwl.data('auto-play'); if ($autoPlay === '') { $autoPlay = false; } $cOwl.owlCarousel({ autoPlay: $autoPlay, nav: false, dots: $pagination, stopOnHover: true, items: $items, singleItem: $singleItem, responsive: { 0: { items: 3 }, 599: { items: 4 }, 768: { items: 5 }, 960: { items: 6 }, 1200: { items: $items } } }); }); $('.strtm-post-carousel > .owl-carousel').each(function () { var $cOwl = $(this); var $items = $cOwl.hasClass('layout-2') ? 3 : 4; var $autoPlay = $cOwl.data('auto-play'); if ($autoPlay === '') { $autoPlay = false; } $cOwl.owlCarousel({ autoPlay: $autoPlay, nav: false, dots: true, stopOnHover: true, margin: 20, dotsEach: true, responsive: { 0: { items: 1 }, 640: { items: 2 }, 991: { items: $items } } }); }); $('.strtm-post-widget .owl-carousel').each(function () { var $cOwl = $(this); $cOwl.owlCarousel({ nav: false, dots: true, dotsEach: true, items: 1 }); }); $('.entry-media .owl-carousel').each(function () { var $cOwl = $(this); var $dots = $(this).data('dots') === false ? false : true; var $autoHeight = $(this).data('height') === false ? false : true; $cOwl.owlCarousel({ navText: ["", ""], nav: true, loop: true, autoHeight: $autoHeight, dots: $dots, dotsEach: true, items: 1 }); }); } } function strtm_gif(){ "use strict"; /* GIF Player */ var $=jQuery; var $gifs=$('img.canopus-gif[src$=".gif"]'); var $gifsL=$gifs.length; if($gifsL){ $gifs.each(function(i){ var $id='canopus-gif-'+$gifsL+'-'+i; var $gif=$(this).attr({"id":$id,"rel:auto_play":ever_script_data.gif_auto}); var $accept=true; if($gif.closest('.starthemes-post-menu').length){ if($gif.closest('.starthemes-post-menu-content').length){ if($gif.closest('.starthemes-post-menu').data('strtm-postmenu-inited')!=='true'){ $accept=false; } }else{ $accept=false; } } if($gif.data('gif-inited')!=='true'&&$accept){ $gif.data('gif-inited','true'); var $gifSrc=$gif.attr('src'); var $gifCont; if($gif.closest('.canopus-gif-container').length){ $gifCont=$gif.closest('.canopus-gif-container'); }else{ $gifCont=$('
'); $gif.before($gifCont); $gifCont.append($gif); $gif.attr('rel:animated_src',$gif.data('animated_src')); } $gifCont.attr({'data-width':($gif.data('width')?$gif.data('width'):0),'data-height':($gif.data('height')?$gif.data('height'):0)}); var $gifSup =new SuperGif({gif:document.getElementById($id),progressbar_height:0}); $gifSup.load(function(){strtm_gif_resize($gifCont,true);}); if(canopus_script_data.gif_auto==='0'){ var $gifBtn =$(''); $gifCont.append($gifBtn); $gifBtn.on('click',function(e){e.preventDefault(); if($gifCont.is('.playing')){ $gifCont.removeClass('playing'); $gifSup.pause(); }else{ $gifCont.addClass('playing'); $gifSup.play(); } return ''; }); } } }); } } function strtm_gif_resize($gifCont,$show){ "use strict"; /* GIF Player */ var $jsgif=$gifCont.find('.jsgif'); var $gifContW=$gifCont.width(); var $gifContDataW = parseInt($gifCont.data('width'),10); var $gifContDataH = parseInt($gifCont.data('height'),10); if($jsgif.length&&$gifContDataW&&$gifContDataH){ $jsgif.css({width:'',height:''}); var $gifContD = $gifContDataW / $gifContDataH; var $gifContH = parseInt($gifContW / $gifContD,10); $gifCont.height($gifContH); var $jsgifH=$jsgif.height(); var $jsgifW=$jsgif.width(); var $top=0; var $left=0; if($gifContH<$jsgifH){ $top=($gifContH-$jsgifH)/2; }else{ $jsgif.height($gifContH); $jsgifW=$gifContH*($jsgifW/$jsgifH); $jsgif.width($jsgifW); $left=($gifContW-$jsgifW)/2; } $jsgif.css({top:$top+'px',left:$left+'px'}); } if($show){ $jsgif.css('opacity','1'); } } function strtm_init(){ "use strict"; var $=jQuery; strtm_gif(); /* Video Responsive */ jQuery('.canopus-container iframe').each(function () { if (!jQuery(this).hasClass('fluidvids-elem')) { jQuery(this).addClass('makeFluid'); } }); if (typeof fluidvids !== undefined && typeof fluidvids !== 'undefined') { fluidvids.init({ selector: ['.canopus-container iframe.makeFluid'], // runs querySelectorAll() players: ['www.youtube.com', 'player.vimeo.com'] // players to support }); jQuery('.canopus-container iframe').removeClass('makeFluid'); } }