(function ($) {
"use strict";
var WidgetCountdownHandler = function () {
if ($(".mc-form").length) {
$(".mc-form").each(function () {
var Self = $(this);
var mcURL = Self.data("url");
var mcResp = Self.parent().find(".mc-form__response");
Self.ajaxChimp({
url: mcURL,
callback: function (resp) {
// appending response
mcResp.append(function () {
return '
' + resp.msg + "
";
});
// making things based on response
if (resp.result === "success") {
// Do stuff
Self.removeClass("errored").addClass("successed");
mcResp.removeClass("errored").addClass("successed");
Self.find("input").val("");
mcResp.find("p").fadeOut(10000);
}
if (resp.result === "error") {
Self.removeClass("successed").addClass("errored");
mcResp.removeClass("successed").addClass("errored");
Self.find("input").val("");
mcResp.find("p").fadeOut(10000);
}
}
});
});
}
if ($(".countdown-one__list").length) {
let mainDate = $('.countdown-one__list').data('deadline-date');
let yearsCondition = $('.countdown-one__list').data('enable-years');
let leadingZeros = $('.countdown-one__list').data('leading-zeros');
let deadLine = ('dynamicDate' == mainDate) ? new Date(Date.parse(new Date()) + 31 * 24 * 60 * 60 * 1000) : mainDate;
$(".countdown-one__list").countdown({
date: deadLine,
leadingZeros: true,
render: function (date) {
this.el.innerHTML =
(true == yearsCondition ? " " + (true == leadingZeros ? this.leadingZeros(date.years) : date.years) + " Years " : " ") +
" " + (true == leadingZeros ? this.leadingZeros(date.days) : date.days) + " Days " +
" " + (true == leadingZeros ? this.leadingZeros(date.hours) : date.hours) + " Hours " +
" " + (true == leadingZeros ? this.leadingZeros(date.min) : date.min) + " Minutes " +
" " + (true == leadingZeros ? this.leadingZeros(date.sec) : date.sec) + " Seconds ";
}
});
}
};
var WidgetMainSliderHandler = function () {
//Main Slider / Banner Carousel
if ($(".banner-carousel").length) {
$(".banner-carousel").owlCarousel({
loop: true,
animateOut: "fadeOut",
animateIn: "fadeIn",
margin: 0,
nav: true,
smartSpeed: 500,
autoplay: 6000,
autoplayTimeout: 7000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 1
},
800: {
items: 1
},
992: {
items: 1
}
}
});
}
};
var WidgetMailchimpHandler = function () {
if ($(".mc-form").length) {
$(".mc-form").each(function () {
var Self = $(this);
var mcURL = Self.data("url");
var mcResp = Self.parent().find(".mc-form__response");
Self.ajaxChimp({
url: mcURL,
callback: function (resp) {
// appending response
mcResp.append(function () {
return '' + resp.msg + "
";
});
// making things based on response
if (resp.result === "success") {
// Do stuff
Self.removeClass("errored").addClass("successed");
mcResp.removeClass("errored").addClass("successed");
Self.find("input").val("");
mcResp.find("p").fadeOut(10000);
}
if (resp.result === "error") {
Self.removeClass("successed").addClass("errored");
mcResp.removeClass("successed").addClass("errored");
Self.find("input").val("");
mcResp.find("p").fadeOut(10000);
}
}
});
});
}
};
var WidgetDefaultHandler = function () {
// swiper slider
const swiperElm = document.querySelectorAll(".thm-swiper__slider");
swiperElm.forEach(function (swiperelm) {
const swiperOptions = JSON.parse(swiperelm.dataset.swiperOptions);
let thmSwiperSlider = new Swiper(swiperelm, swiperOptions);
});
//Single Item Carousel
if ($(".single-item-carousel").length) {
$(".single-item-carousel").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 500,
autoplay: 5000,
autoplayHoverPause: true,
autoplayTimeout: 5000,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 1
},
800: {
items: 1
},
1024: {
items: 1
}
}
});
}
//LightBox / Fancybox
if ($(".lightbox-image").length) {
$(".lightbox-image").fancybox({
openEffect: "fade",
closeEffect: "fade",
helpers: {
media: {}
}
});
}
// Donation Progress Bar
if ($(".count-bar").length) {
$(".count-bar").appear(
function () {
var el = $(this);
var percent = el.data("percent");
$(el).css("width", percent).addClass("counted");
}, {
accY: -50
}
);
}
//Fact Counter + Text Count
if ($(".count-box").length) {
$(".count-box").appear(
function () {
var $t = $(this),
n = $t.find(".count-text").attr("data-stop"),
r = parseInt($t.find(".count-text").attr("data-speed"), 10);
if (!$t.hasClass("counted")) {
$t.addClass("counted");
$({
countNum: $t.find(".count-text").text()
}).animate({
countNum: n
}, {
duration: r,
easing: "linear",
step: function () {
$t.find(".count-text").text(Math.floor(this.countNum));
},
complete: function () {
$t.find(".count-text").text(this.countNum);
}
});
}
}, {
accY: 0
}
);
}
}
var WidgetAccordionHandler = function () {
//Accordion Box
if ($(".accordion-box").length) {
var accrodionGrp = $(".accordion-box");
accrodionGrp.each(function () {
var accrodionName = $(this).attr("id");
var Self = $(this);
var accordion = Self.find(".accordion");
Self.addClass(accrodionName);
Self.find(".accordion .acc-content").hide();
Self.find(".accordion.active-block").find(".acc-content").show();
accordion.each(function () {
$(this)
.find(".acc-btn")
.on("click", function () {
if ($(this).parent().hasClass("active-block") === false) {
$(".accordion-box." + accrodionName)
.find(".accordion")
.removeClass("active-block");
$(".accordion-box." + accrodionName)
.find(".accordion")
.find(".acc-content")
.slideUp();
$(this).parent().addClass("active-block");
$(this)
.parent()
.find(".acc-content")
.slideDown();
}
});
});
});
}
}
var WidgetPortfolioHandler = function () {
//MixitUp Gallery Filters
if ($(".filter-list").length) {
$(".filter-list").mixItUp({});
}
//Product Tabs
if ($(".project-tab").length) {
$(".project-tab .product-tab-btns .p-tab-btn").on("click", function (e) {
e.preventDefault();
var target = $($(this).attr("data-tab"));
if ($(target).hasClass("actve-tab")) {
return false;
} else {
$(".project-tab .product-tab-btns .p-tab-btn").removeClass(
"active-btn"
);
$(this).addClass("active-btn");
$(".project-tab .p-tabs-content .p-tab").removeClass("active-tab");
$(target).addClass("active-tab");
}
});
}
//Project Carousel
if ($(".project-carousel").length) {
$(".project-carousel").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 700,
autoplay: 5000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
768: {
items: 2
},
992: {
items: 3
},
1200: {
items: 3
},
1500: {
items: 4
},
1600: {
items: 4
}
}
});
}
//Project Carousel
if ($(".project-carousel-two").length) {
$(".project-carousel-two").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 700,
autoplay: 5000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 1
},
768: {
items: 2
},
992: {
items: 3
},
1200: {
items: 3
}
}
});
}
}
var WidgetTeamHandler = function () {
//Team Carousel
if ($(".team-carousel").length) {
$(".team-carousel").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 700,
autoplay: 5000,
autoplayTimeout: 5000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 2
},
992: {
items: 3
},
1200: {
items: 4
},
1500: {
items: 4
},
1600: {
items: 5
}
}
});
}
//Team Carousel
if ($(".team-carousel__one-page").length) {
$(".team-carousel__one-page").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 700,
autoplay: 5000,
autoplayTimeout: 5000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 2
},
992: {
items: 3
},
1200: {
items: 3
},
1500: {
items: 3
},
1600: {
items: 3
}
}
});
}
}
var WidgetSponsorsHandler = function () {
//Sponsors Carousel
if ($(".sponsors-carousel").length) {
$(".sponsors-carousel").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 700,
autoplay: 5000,
autoplayTimeout: 5000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 2
},
768: {
items: 3
},
992: {
items: 4
},
1200: {
items: 5
}
}
});
}
}
var WidgetTestimonialsHandler = function () {
//Testimonial Carousel
if ($(".testimonials-carousel").length) {
$(".testimonials-carousel").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 700,
autoplay: 5000,
autoplayTimeout: 5000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 1
},
768: {
items: 1
},
992: {
items: 2
},
1200: {
items: 2
}
}
});
}
//Testimonial Carousel
if ($(".testimonials-carousel-two").length) {
$(".testimonials-carousel-two").owlCarousel({
loop: true,
margin: 30,
nav: true,
smartSpeed: 700,
autoplay: 5000,
autoplayTimeout: 5000,
autoplayHoverPause: true,
navText: [
'',
''
],
responsive: {
0: {
items: 1
},
600: {
items: 1
},
768: {
items: 1
},
1200: {
items: 1
}
}
});
}
if ($(".testimonials-four-carousel").length) {
$(".testimonials-four-carousel").owlCarousel({
loop: true,
margin: 30,
nav: false,
smartSpeed: 700,
autoplay: 5000,
autoplayTimeout: 5000,
autoplayHoverPause: true,
dots: true,
responsive: {
0: {
items: 1
},
600: {
items: 1
},
768: {
items: 2
},
1200: {
items: 3
}
}
});
}
}
var WidgetContactFormHandler = function () {
//Custom Seclect Box
if ($(".custom-select-box").length) {
$(".custom-select-box")
.selectmenu()
.selectmenu("menuWidget")
.addClass("overflow");
}
}
var WidgetFeaturedHandler = function () {
//Tabs Box
if ($(".tabs-box").length) {
$(".tabs-box .tab-buttons .tab-btn").on("click", function (e) {
e.preventDefault();
var target = $($(this).attr("data-tab"));
if ($(target).is(":visible")) {
return false;
} else {
target
.parents(".tabs-box")
.find(".tab-buttons")
.find(".tab-btn")
.removeClass("active-btn");
$(this).addClass("active-btn");
target
.parents(".tabs-box")
.find(".tabs-content")
.find(".tab")
.fadeOut(0);
target
.parents(".tabs-box")
.find(".tabs-content")
.find(".tab")
.removeClass("active-tab");
$(target).fadeIn(300);
$(target).addClass("active-tab");
}
});
}
//Jquery Knob animation
if ($(".dial").length) {
$(".dial").appear(
function () {
var elm = $(this);
var color = elm.attr("data-fgColor");
var perc = elm.attr("value");
var thickness = elm.attr("data-thickness");
elm.knob({
value: 0,
min: 0,
max: 100,
skin: "tron",
readOnly: true,
thickness: thickness,
dynamicDraw: true,
displayInput: false
});
$({
value: 0
}).animate({
value: perc
}, {
duration: 2000,
easing: "swing",
progress: function () {
elm.val(Math.ceil(this.value)).trigger("change");
}
});
}, {
accY: 0
}
);
}
}
//elementor front start
$(window).on("elementor/frontend/init", function () {
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-main-slider.default",
WidgetMainSliderHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/widget",
WidgetDefaultHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/footer-subscribe.default",
WidgetMailchimpHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-accordion.default",
WidgetAccordionHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-portfolio.default",
WidgetPortfolioHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-team.default",
WidgetTeamHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-sponsors.default",
WidgetSponsorsHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-testimonials.default",
WidgetTestimonialsHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-contact-form.default",
WidgetContactFormHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-featured.default",
WidgetFeaturedHandler
);
elementorFrontend.hooks.addAction(
"frontend/element_ready/linoor-coming-soon.default",
WidgetCountdownHandler
);
});
})(jQuery);