jQuery(document).ready(function($) {
if(typeof testimonial_settings !== "undefined"){
var $testimonialspace = 30;
var $testimonialspace_laptop = 20, $testimonialspace_tablet = 15, $testimonialspace_mobile = 10;
if(typeof testimonial_settings['hostiko_testimonial_space'] !== "undefined"){
$testimonialspace = testimonial_settings['hostiko_testimonial_space']['size'];
}
if(typeof testimonial_settings['hostiko_testimonial_space_laptop'] !== "undefined"){
$testimonialspace_laptop = testimonial_settings['hostiko_testimonial_space_laptop']['size'];
}
if(typeof testimonial_settings['hostiko_testimonial_space_tablet'] !== "undefined"){
$testimonialspace_tablet = testimonial_settings['hostiko_testimonial_space_tablet']['size'];
}
if(typeof testimonial_settings['hostiko_testimonial_space_mobile'] !== "undefined"){
$testimonialspace_mobile = testimonial_settings['hostiko_testimonial_space_mobile']['size'];
}
if(typeof testimonial_settings !== "undefined"){
// let dots = testimonial_settings['hostiko_show_dots'];
// let nav = testimonial_settings['hostiko_show_nav'];
jQuery('.hostiko-testimonial-section .owl-carousel').owlCarousel({
margin:$testimonialspace,
responsiveClass:true,
loop: true,
nav:(testimonial_settings['hostiko_show_nav']=='true')?true:false,
items:testimonial_settings['hostiko_slides_to_show'],
dots: (testimonial_settings['hostiko_show_dots'] =='true')?true:false,
responsive:{
0:{
items:testimonial_settings['hostiko_slides_to_show_mobile'],
margin:$testimonialspace_mobile,
nav: (testimonial_settings['hostiko_show_nav_mobile']=='true')?true:false,
dots: (testimonial_settings['hostiko_show_dots_mobile']=='true')?true:false,
},
768:{
items:testimonial_settings['hostiko_slides_to_show_tablet'],
margin:$testimonialspace_tablet,
nav: (testimonial_settings['hostiko_show_nav_tablet']=='true')?true:false,
dots: (testimonial_settings['hostiko_show_dots_tablet']=='true')?true:false,
},
1025:{
items:testimonial_settings['hostiko_slides_to_show_laptop'],
margin:$testimonialspace_laptop,
nav: (testimonial_settings['hostiko_show_nav_laptop']=='true')?true:false,
dots: (testimonial_settings['hostiko_show_dots_laptop']=='true')?true:false,
},
1367:{
items:testimonial_settings['hostiko_slides_to_show'],
margin:$testimonialspace,
nav: (testimonial_settings['hostiko_show_nav']=='true')?true:false,
dots: (testimonial_settings['hostiko_show_dots']=='true')?true:false,
}
}
});
}
}
})
jQuery(document).on('click','#transfer_btn', function($){
let domainName = jQuery('#domain_search_outter').find('#searchtdomain').val();
window.open($Whmcs_Link+"/cart.php?a=add&domain=transfer&query="+domainName, '_blank');
});
jQuery(document).on('click', '#search_btn', function ($) {
var serachBtn = jQuery('#search_btn');
var searchbtnText = serachBtn.text();
//$('#search_btn').find('.res-msg').html('');
let domainName = jQuery('#domain_search_outter').find('#searchtdomain').val();
//TLDs from the User
var userTLD = $whmcs_tlds;
var userTLDArray = userTLD.split(',');
//Static TLDs
var domainTlds = ["com", "net", "org"];
var domainTldSplit = domainName.split('.');
if (domainName != '' && typeof (domainName) != undefined) {
serachBtn.html('Loading ');
if (userTLDArray.length >= 1 && typeof (userTLDArray) != undefined && userTLDArray != '') {
domainTlds = userTLDArray;
}
if (domainTldSplit.length <= 1) {
var completedSearchRequests = 0;
var domainStatusCheck = jQuery('#domainCartOption').find('ul').empty();
jQuery.each(domainTlds, function (index, value) {
jQuery.ajax({
type: "POST",
url: redux_widget_ajax_object.ajaxurl,
data: {
action: 'domainWhoisCheck',
domain: domainName + '.' + value,
},
success: function (res) {
completedSearchRequests++;
var data = JSON.parse(res);
if (data.result == "success" && (data.whois != "" && typeof (data.whois) != undefined)) {
var domainStatusCheck = jQuery('#domainCartOption').find('ul');
domainStatusCheck.append('
Sorry! ' + domainName + '.' + value + ' is already taken.
Whois');
} else if (data.result == "success" && data.status == "available" && data.whois == "") {
var domainStatusCheck = jQuery('#domainCartOption').find('ul');
domainStatusCheck.append(' Congratulations! ' + domainName + '.' + value + ' is available.
Get Now');
} else if (data.result == "error") {
var domainStatusCheck = jQuery('#domainCartOption').find('ul');
domainStatusCheck.append(' Sorry! ' + domainName + '.' + value + ' tld not supported.
ERROR');
}
if (completedSearchRequests === domainTlds.length) {
// All requests are complete, hide the loader
serachBtn.html(searchbtnText);
}
},
error: function (res) {
jQuery('#domain_search_outter').find('#domain_whois_result').html(data.result);
jQuery('#domain_search_outter').find('.domainCartName').html(data.status);
searchbtnText.html(searchbtnText);
}
});
});
} else if (domainTldSplit.length > 1) {
var domainStatusCheck = jQuery('#domainCartOption').find('ul').empty();
jQuery.ajax({
type: "POST",
url: redux_widget_ajax_object.ajaxurl,
data: {
action: 'domainWhoisCheck',
domain: domainName,
},
success: function (res) {
var data = JSON.parse(res);
if (data.result == "success" && (data.whois != "" && typeof (data.whois) != undefined)) {
var domainStatusCheck = jQuery('#domainCartOption').find('ul');
domainStatusCheck.append(' Sorry! ' + domainName + ' is already taken.
');
} else if (data.result == "success" && data.status == "available" && data.whois == "") {
var domainStatusCheck = jQuery('#domainCartOption').find('ul');
domainStatusCheck.append(' Congratulations! ' + domainName + ' is available.
Get Now');
} else if (data.result == "error") {
var domainStatusCheck = jQuery('#domainCartOption').find('ul');
domainStatusCheck.append(' Sorry! ' + domainName + ' tld not supported.
');
}
serachBtn.html(searchbtnText);
},
error: function (res) {
jQuery('#domain_search_outter').find('#domain_whois_result').html(data.result);
jQuery('#domain_search_outter').find('.domainCartName').html(data.status);
serachBtn.html(searchbtnText);
}
});
}
}
});
jQuery(document).on('click', '.popup', function(){
jQuery(this).find('#myPopup').toggleClass("show");
});
// $('.hostiko-domain-modal-link').click(function()
jQuery(document).on('click', '.hostiko-domain-modal-link', function(){
jQuery('.hostiko-domain-modal').show();
jQuery('.hostiko-domain-modal-bg').show();
});
// $('.hostiko-domain-modal .close').click(function()
jQuery(document).on('click', '.hostiko-domain-modal .close', function(){
jQuery('.hostiko-domain-modal').hide();
jQuery('.hostiko-domain-modal-bg').hide();
})
jQuery(window).on('load', function () {
setTimeout(function () {
jQuery('select.hostiko-select-field').trigger('change');
// Iterate through each list item
var selectoption = jQuery('select.hostiko-select-field option');
jQuery.each(selectoption, function (key, val) {
let is_prefix = true;
let prefix = jQuery(val).data('prefix');
if (typeof prefix === 'undefined' || prefix == '') {
prefix = jQuery(val).data('postfix');
is_prefix = false;
}
let price = jQuery(val).data('price');
var integerPart = Math.floor(price); // Get the integer part
var decimalPart = (price % 1).toFixed(2).substring(2); // Get the decimal part with .00
var priceString = '.' + decimalPart; // Combine integer and decimal parts
let cycle = jQuery(val).data('cycle');
if (is_prefix) {
price = prefix + '' + price;
} else {
price = price + '' + prefix;
}
var spanCycle = jQuery('').text(cycle);
var spanPrice = jQuery('').text(price);
let niceselect = jQuery('.hostiko-select-field .list .option');
jQuery.each(niceselect, function (nkey, nval) {
if (key == nkey) {
jQuery(nval).empty().append(spanCycle).append(spanPrice);
}
});
});
}, 1000);
});
jQuery(document).on('change', '.hostiko-select-field', function () {
var el = jQuery(this);
var parent = el.closest('.e-child');
var element = parent.find('.hostiko-whmcs-price-outer');
var option = el.find('option:selected');
var prefix = option.data('prefix');
var price = option.data('price');
var cycle = option.data('cycle');
var url = option.data('product');
var isPrefix = true;
if (typeof prefix === 'undefined' || prefix == '') {
isPrefix = false;
prefix = option.data('postfix');
}
var priceTxt = '';
if (prefix) {
priceTxt = prefix + "" + price;
} else {
priceTxt = price + "" + prefix;
}
var integerPart = Math.floor(price); // Get the integer part
var decimalPart = (price % 1).toFixed(2).substring(2); // Get the decimal part with .00
var priceString = '.' + decimalPart; // Combine integer and decimal parts
element.find('.currency').text(prefix);
element.find('.price').text(integerPart);
element.find('.decimal').text(priceString);
element.find('.duration').text(cycle);
var spanPrice = '' + priceTxt + '-' + cycle + '';
var anchor = parent.find('.whmcs-product-btn-outer a');
var useCustom = anchor.data('custom');
var layout = anchor.data('layout');
var finalUrl = url + '&billingcycle=' + cycle;
if (useCustom === 'yes' && layout !== '') {
finalUrl += '&systpl=hostiko&layout=' + layout;
}
parent.find('div.hostiko-select-field .current').html(spanPrice);
parent.find('.whmcs-product-btn-outer a').attr('href', finalUrl);
});
jQuery(document).ready(function () {
var comparisionCount = 0;
if(comparisionCount == 0){
jQuery('td:nth-child(2)').css('display', 'table-cell');
}
jQuery(".Comprison_pricingplan ul").on("click", "li.tabs-list", function () {
var pos = jQuery(this).index() + 2;
jQuery("tr.tbl_body_content").find('td:not(:eq(0))').hide();
jQuery('td:nth-child(' + pos + ')').css('display', 'table-cell');
jQuery("tr.tbl_body_content").find('th:not(:eq(0))').hide();
jQuery('li.tbl_body_content').removeClass('active');
jQuery('li.tabs-list').removeClass('active');
jQuery(this).addClass('active');
comparisionCount++;
});
// Responsive pricing table JS
// Initialize the media query
var mediaQuery = window.matchMedia('(min-width: 768px)');
// Add a listen event
mediaQuery.addListener(doSomething);
// Function to do something with the media query
function doSomething(mediaQuery) {
if (mediaQuery.matches) {
jQuery('.sep').attr('colspan', 5);
} else {
jQuery('.sep').attr('colspan', 2);
}
}
// On load
doSomething(mediaQuery);
jQuery("#loadMore").on("click", function (e) {
jQuery('.comparison_plan_cont').toggleClass("tbl_height");
});
});