jQuery(function($) { // Initialize
//add .btn to input and wrap class
var button = $(this).find('input[type="submit"],input[type="button"],input[type="reset"],button,.btn').not('.quantity-controls,.jv-ajax-cart--item-remove,.bootstrap-touchspin');
button.addClass('btn btn-primary');
button.wrap('');
button.before('');
var input = $(this).find('input,select,textarea').not('input[type="submit"],input[type="button"],input[type="reset"],input[type="hidden"]');
$.each(input, function(i, val) {
var input_class = $(this).attr('name');
if (input_class) {
$(this).wrap('');
$(this).before('');
}
});
//accordion hash change
if (location.hash != null && location.hash != "") {
$('.collapse').removeClass('in');
$(location.hash + '.collapse').collapse('show');
}
var loading = $(this).find('.b-lazy');
if (loading.length) {
loading.parent().addClass('loading');
var bLazyload = new Blazy({
loadInvisible: true,
success: function(element) {
loading.parent().addClass('end');
setTimeout(function() {
loading.parent().removeClass('loading');
$.fn.matchHeight._update();
}, 200);
}
});
}
//effect affix menu
if ($('.tpl-block--nav').length) {
$('.tpl-block--nav').affix({
offset: {
top: 35
}
})
}
//append titlepage to breadcrum
var titlepage = $('h1.titlePage,.componentheading').first(),
heading = $('.tpl-breadcrumb-heading').append(titlepage);
//search active
var spoint = '.tpl-block--search',
cpoint = '#mod-search-searchword';
$(document).delegate('.btn-icon-searchword i', 'click.tosearch', function() {
$(this).closest(spoint).toggleClass('active');
$(cpoint).parent().removeClass('open');
return false;
}).on('click.rsearch', function(e) {
var target = $(e.target);
if (target.is(spoint) || target.closest(spoint).length) {
return;
}
$(spoint).removeClass('active');
});
//split module-title with '|'
var string = $(this).find('.title-module');
$.each(string, function(i, val) {
var data = $(this).text();
var arr = data.split('|');
if (arr.length > 1) {
$(this).html("" + arr[0] + "" + arr[1] + "");
$(this).addClass('title-module-center');
} else {
$(this).addClass('title-module-topleft');
}
});
//append module
if ($('.callmodule-other-services').length) {
$('.callmodule-other-services').append($('.module-other-services'));
}
//social like
var facebook = $(this).find('.count');
$.each(facebook, function(i, v) {
var $this = $(this),
url = 'http://graph.facebook.com/' + $this.attr('data-url');
if (url) {
$this.attr("href", 'http://facebook.com/sharer/sharer.php?u=' + $this.attr('data-url'));
$this.click(function() {
window.open(this.href);
return false;
});
$.getJSON(url, function(data) {}).done(function(data) {
$this.prepend((data.shares || '0k'));
})
.fail(function(data) {
$this.prepend('0k');
})
.always(function(data) {
});
} else {
$this.prepend(0);
}
});
//readmore
var readmore = $(this).find('.post-readmore,.k2ReadMore'),
readmore_icon = $(this).find('.post-readmore .fa,.k2ReadMore .fa');
if (!readmore_icon.length) {
readmore.addClass('read-more float-right');
readmore.append('');
} else {
readmore.addClass('read-more float-right');
}
//panel class
if ($('.tpl-block--panel').length) {
var panel = $('.tpl-block--panel > div > div').attr('class').split(' ');
if ($('.has-block-panel')) {
$('.has-block-panel').addClass('has-block-panel-' + panel[panel.length - 1]);
}
}
if ($('.module-panel-5,.module-panel-6').length) {
$('.tpl-block--search').appendTo($('.module-panel-5 .languages-list'));
$('.tpl-block--search').appendTo($('.module-panel-6 .languages-list'));
$('.tpl-block--getquote').appendTo($('.tpl-block--nav-wrapper'));
}
//end
//shop
//vmfilter
var vm_filter = '.sidebar .jv-module.module-vm-filter .jv-module';
$(vm_filter + " > h3").click(function() {
$(this).parent().children(".contentmod,.jv-customfields_vm ul").slideToggle("slow");
$(this).parent().toggleClass('active');
});
});
jQuery(function($) {
$(".additional-images2").owlCarousel({
items: 3,
dots: false,
nav: true,
loop: true,
margin: 15,
responsiveClass: true,
responsive: {
0: {
items: 2,
nav: true
},
600: {
items: 3,
nav: false
},
1000: {
items: 3,
nav: true,
loop: false
}
}
});
});
jQuery(function($) {
var $grid = $(".grid").masonry({
itemSelector: ".grid-item",
percentPosition: true
});
$grid.imagesLoaded().progress(function() {
$grid.masonry('layout');
});
});
//equal height
jQuery(function($) {
$('[data-equalheight="equal-child"]').matchHeight();
$('[data-equalheight="equal-parent"]').matchHeight();
$('[data-equalheight="equal-child-nofixrow"]').matchHeight({
byRow: false
});
$('[data-equalheight="equal-parent-nofixrow"]').matchHeight({
byRow: false
});
});