( function( $ ) {
"use strict";
/**
* debouncing function from John Hann
* http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
*/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
timeout = null;
};
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
};
};
/**
* Register smartresize plugin
*/
$.fn['smartresize'] = function(fn){
return fn ? this.bind('resize', debounce(fn)) : this.trigger('smartresize');
};
} ).call( this, jQuery );
( function( $ ) {
"use strict";
var doc = $( document ),
win = $( window );
$( function() {
win.smartresize( Waypoint.refreshAll )
.on( 'load', Waypoint.refreshAll );
if ( $.fn.countTo ) {
$( '.counter' ).each( function() {
var counted = false;
$( this ).data( 'waypoint.inview', new Waypoint.Inview( {
element: this,
enter: function() {
if ( counted == false ) {
counted = true;
$( '.counter-value', this.element ).countTo();
}
}
} ) )
} );
}
// Countdown
if ( $.fn.countdown ) {
$( '.countdown' ).each( function() {
var format = [],
parts = $( this ).attr( 'data-hidden' ).split( ',' ),
config = {
year: '%-Y %!Y:' + _countdownLocalize['year'] + ',' + _countdownLocalize['year'] + 's;',
month: '%-m %!m:' + _countdownLocalize['month'] + ',' + _countdownLocalize['month'] + 's;',
week: '%-w %!w:' + _countdownLocalize['week'] + ',' + _countdownLocalize['week'] + 's;',
day: '%-d %!d:' + _countdownLocalize['day'] + ',' + _countdownLocalize['day'] + 's;',
hour: '%-H %!H:' + _countdownLocalize['hour'] + ',' + _countdownLocalize['hour'] + 's;',
minute: '%-M %!M:' + _countdownLocalize['minute'] + ',' + _countdownLocalize['minute'] + 's;',
second: '%-S %!S:' + _countdownLocalize['second'] + ',' + _countdownLocalize['second'] + 's;'
};
if ( parts.indexOf( 'week' ) != -1 ) {
config.day = '%-D %!D:' + _countdownLocalize['day'] + ',' + _countdownLocalize['day'] + 's;';
}
$.map( config, function( value, key ) {
if ( parts.indexOf( key ) == -1 )
format.push( value );
} );
$( this ).countdown( $( this ).attr( 'data-time' ), function( evt ) {
$(this).html( evt.strftime( format.join( ' ' ) ) );
} )
} );
}
// Post Carousel
$( '.blog-shortcode.blog-carousel' ).each( function() {
var container = $( this ),
columns = 1;
if ( container.hasClass( 'blog-two-columns' ) ) columns = 2;
if ( container.hasClass( 'blog-three-columns' ) ) columns = 3;
if ( container.hasClass( 'blog-four-columns' ) ) columns = 4;
if ( container.hasClass( 'blog-five-columns' ) ) columns = 5;
var entriesWrapper = $( '.entries-wrapper', container )
.addClass( 'owl-carousel' )
.imagesLoaded( function() {
entriesWrapper.owlCarousel( {
items: columns,
navigation: true,
autoPlay: true,
stopOnHover: true,
itemsDesktop : [1199, columns],
itemsDesktopSmall : [979, 3],
itemsTablet : [768, 2],
scrollPerPage: true,
slideSpeed: 800,
autoHeight : true,
responsiveBaseWidth: entriesWrapper
} );
} );
} );
// Elements Carousel
$( '.elements-carousel' ).each( function() {
try {
var element = $( this );
var config = JSON.parse( element.attr( 'data-config' ) );
element.imagesLoaded( function() {
$( '.elements-carousel-wrap', element ).owlCarousel( config );
} );
}
catch( e ) {}
} );
} );
} ).call( this, jQuery );