/*
[Main Script]
Project: CloudServer - Responsive HTML5 Technology, Web Hosting and WHMCS Template
Version: 1.9
Author : themelooks.com
*/
;(function ($) {
"use strict";
/* ------------------------------------------------------------------------- *
* COMMON VARIABLES
* ------------------------------------------------------------------------- */
var $wn = $(window),
$body = $('body');
/* ------------------------------------------------------------------------- *
* FAKELOADER
* ------------------------------------------------------------------------- */
var $fakeLoader = $('#fakeLoader');
if ( $fakeLoader.length ) {
$fakeLoader.fakeLoader({ spinner: "spinner2", zIndex: '99999' });
}
$(function () {
/* ------------------------------------------------------------------------- *
* BACKGROUND IMAGE
* ------------------------------------------------------------------------- */
var $bgImg = $('[data-bg-img]');
$bgImg.each(function () {
var $t = $(this);
$t.css('background-image', 'url(' + $t.data('bg-img') + ')').addClass('bg--img').removeAttr('data-bg-img');
});
/* ------------------------------------------------------------------------- *
* BACKGROUND VIDEO
* ------------------------------------------------------------------------- */
var $bgVideo = $('[data-bg-video]');
if ( $bgVideo.length ) {
$bgVideo.tubular({videoId: $bgVideo.data('bg-video'), wrapperZIndex: 0});
}
/* ------------------------------------------------------------------------- *
* STICKYJS
* ------------------------------------------------------------------------- */
var $sticky = $('[data-sticky="true"]');
if ( $sticky.length ) {
$sticky.sticky({
zIndex: '999'
});
}
/* -------------------------------------------------------------------------*
* MENU
* -------------------------------------------------------------------------*/
var $menu = $('#menu'),
$offCanvasMenu = $('.off-canvas-menu'),
$offCanvasMenuLinks = $('.off-canvas-menu .nav > li > a');
$menu.on('click', '.menu-toggle-btn, .off-canvas-menu--close-btn, .off-canvas-menu-overlay', function (e) {
e.preventDefault();
$offCanvasMenu.toggleClass('menu-open');
});
$offCanvasMenuLinks.one('click', function () {
var $parent = $(this).parent('li');
if ( $parent.hasClass('opened') ) {
$parent.toggleClass('opened open');
} else {
$parent.siblings('li.opened').toggleClass('opened open');
}
});
/* -------------------------------------------------------------------------*
* FORM VALIDATION
* -------------------------------------------------------------------------*/
var $formValidation = $('[data-form-validation="true"] form');
$formValidation.each(function () {
var $t = $(this);
$t.validate({
errorPlacement: function (error, element) {
return true;
}
});
});
var contactForm = $('#contactForm')
, contactFormStatus = $('.contact-form-status');
if ( contactForm.length ) {
contactForm.validate({
rules: {
contactName: "required",
contactEmail: {
required: true,
email: true
},
contactSubject: "required",
contactMessage: "required"
},
errorPlacement: function (error, element) {
return true;
},
submitHandler: function(e) {
var formData = contactForm.serialize(); // serialize the form data
/* Submit the form using AJAX */
$.ajax({
type: 'POST',
url: contactForm.attr('action'),
data: formData
})
.done(function(response) {
contactFormStatus.show().html(response).delay(1000).fadeOut("slow");
});
}
});
}
/* -------------------------------------------------------------------------*
* OWL CAROUSEL
* -------------------------------------------------------------------------*/
var testimonialSlider = $('.testimonial-slider');
if ( testimonialSlider.length ) {
testimonialSlider.owlCarousel({
slideSpeed: 700,
paginationSpeed: 700,
singleItem: true,
autoPlay: true,
addClassActive: true
});
}
var $pricingSlider = $('.pricing--slider');
if ( $pricingSlider.length ) {
$pricingSlider.owlCarousel({
slideSpeed: 800,
paginationSpeed: 800,
items: 3,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [991, 2],
itemsTablet: [767, 1]
});
}
/* ------------------------------------------------------------------------- *
* VPS PRICING AREA
* ------------------------------------------------------------------------- */
var $vpsPricing = $('#vpsPricing'),
vpsPricingObj = {};
vpsPricingObj.$slider = $vpsPricing.find('#vpsSlider');
vpsPricingObj.$putValue = $vpsPricing.find('[data-put-value]');
vpsPricingObj.$putHref = $vpsPricing.find('[data-put-href]');
vpsPricingObj.slider = function (res) {
vpsPricingObj.slider.value = 1;
vpsPricingObj.slider.max = res.length - 1;
vpsPricingObj.slider.changeValue = function (e, ui) {
vpsPricingObj.slider.value = $.isEmptyObject( ui ) ? vpsPricingObj.slider.value : ui.value;
vpsPricingObj.$slider.find('.ui-slider-handle').html( '' + res[ vpsPricingObj.slider.value ].title + '' );
vpsPricingObj.$putValue.each(function () {
var $t = $(this);
$t.text( res[ vpsPricingObj.slider.value ][ $t.data('put-value') ] );
});
vpsPricingObj.$putHref.attr('href', res[ vpsPricingObj.slider.value ][ vpsPricingObj.$putHref.data('put-href') ] );
};
vpsPricingObj.$slider.slider({
animate: 'fast',
range: 'min',
min: 0,
max: vpsPricingObj.slider.max,
value: vpsPricingObj.slider.value,
step: 1,
create: vpsPricingObj.slider.changeValue,
slide: vpsPricingObj.slider.changeValue
});
};
if ( $vpsPricing.length ) {
$.getJSON('/json/vps-plans.php?currency_id=4&page=biz', vpsPricingObj.slider)
.done(function () {
vpsPricingObj.$items = $vpsPricing.find('.vps-pricing--items');
vpsPricingObj.$tag = $vpsPricing.find('.vps-pricing--tag');
vpsPricingObj.$tag.css( 'height', vpsPricingObj.$items.height() );
$wn.on('resize', function () {
vpsPricingObj.$tag.css( 'height', vpsPricingObj.$items.height() );
});
});
}
/* -------------------------------------------------------------------------*
* COUNTER UP
* -------------------------------------------------------------------------*/
var $counterUp = $('[data-counter-up="true"]');
if ( $counterUp.length ) {
$counterUp.counterUp({
delay: 10,
time: 1000
});
}
/* -------------------------------------------------------------------------*
* COUNTDOWN
* -------------------------------------------------------------------------*/
var $countDown = $('[data-counter-down]');
$countDown.each(function () {
var $t = $(this);
$t.countdown($t.data('counter-down'), function(e) {
$(this).html( e.strftime('%D Days %H:%M:%S') );
});
});
/* -------------------------------------------------------------------------*
* ANIMATESCROLL
* -------------------------------------------------------------------------*/
var $animateScrollLink = $('[data-animate-scroll="true"]'),
animateScrolling = function (e) {
e.preventDefault();
var targetEl = $(this).attr('href'),
offset = typeof $(this).data('offset') === 'undefined' ? 0 : $(this).data('offset');
$(targetEl).animatescroll({
padding: 65,
easing: 'easeInOutExpo',
scrollSpeed: 2000
});
};
$animateScrollLink.on('click', animateScrolling);
/* -------------------------------------------------------------------------*
* GALLERY AREA
* -------------------------------------------------------------------------*/
var $galleryItems = $('.gallery--items'),
galleryItem = '.gallery--item',
$galleryFilter = $('.gallery--filter-menu');
if ( $galleryItems.length ) {
$galleryItems.isotope({
animationEngine: 'best-available',
itemSelector: galleryItem
});
$galleryFilter.on('click', 'a', function () {
var $t = $(this),
f = $t.attr('href'),
s = (f !== '*') ? '[data-cat~="'+ f +'"]' : f;
$galleryItems.isotope({
filter: s
});
$t.parent('li').addClass('active').siblings().removeClass('active');
return false;
});
$galleryItems.magnificPopup({
delegate: '.gallery--img a',
type:'image',
gallery: {
enabled: true,
navigateByImgClick: false
},
zoom: {
enabled: true
},
callbacks: {
open: function () {
this.currItem.el.addClass('active');
},
close: function () {
this.currItem.el.removeClass('active');
}
}
});
}
/* -------------------------------------------------------------------------*
* MAP
* -------------------------------------------------------------------------*/
var $map = $('#map'),
setMap = function () {
var map = new google.maps.Map($map[0], {
center: {lat: $map.data('map-latitude'), lng: $map.data('map-longitude')}, // {lat: 23.790546, lng: 90.375583}
zoom: $map.data('map-zoom'), // 16
scrollwheel: false,
disableDefaultUI: true,
zoomControl: true
});
if ( typeof $map.data('map-marker') !== 'undefined' ) {
var data = $map.data('map-marker'),
i = 0;
for ( i; i < data.length; i++ ) {
new google.maps.Marker({
position: {lat: data[i][0], lng: data[i][1]},
map: map,
animation: google.maps.Animation.DROP,
draggable: true
});
}
}
};
if ( $map.length ) {
setMap();
}
/* -------------------------------------------------------------------------*
* PRICING TABLE AREA
* -------------------------------------------------------------------------*/
var $hasPricingHead = $('[data-has-pricing-head="no"]'),
adjustNoPricingHead = function () {
$hasPricingHead.children('.pricing--content').css('margin-top', $hasPricingHead.siblings().find('.pt-head').outerHeight() );
};
if ( $hasPricingHead.length ) {
adjustNoPricingHead();
$wn.on('resize', adjustNoPricingHead);
}
/* -------------------------------------------------------------------------*
* DOMAIN PRICING AREA
* -------------------------------------------------------------------------*/
var $domainPricing = $('#domainPricing'),
$dedicatedPricing = $('#dedicatedPricing');
$domainPricing.add($dedicatedPricing).find('table td').each(function () {
var $t = $(this);
$t.prepend(''+ $t.data('label') + '');
});
/* -------------------------------------------------------------------------*
* COLOR SWITCHER
* -------------------------------------------------------------------------*/
if ( typeof $.cColorSwitcher !== "undefined" && $wn.outerWidth() > 767 ) {
$.cColorSwitcher({
'switcherTitle': 'Main Colors:',
'switcherColors': [{
bgColor: '#288feb',
filepath: 'css/colors/theme-color-1.css'
}, {
bgColor: '#8bc34a',
filepath: 'css/colors/theme-color-2.css'
}, {
bgColor: '#03a9f4',
filepath: 'css/colors/theme-color-3.css'
}, {
bgColor: '#ff5252',
filepath: 'css/colors/theme-color-4.css'
}, {
bgColor: '#ff9600',
filepath: 'css/colors/theme-color-5.css'
}, {
bgColor: '#e91e63',
filepath: 'css/colors/theme-color-6.css'
}, {
bgColor: '#00BCD4',
filepath: 'css/colors/theme-color-7.css'
}, {
bgColor: '#FC5143',
filepath: 'css/colors/theme-color-8.css'
}, {
bgColor: '#00B249',
filepath: 'css/colors/theme-color-9.css'
}, {
bgColor: '#D48B91',
filepath: 'css/colors/theme-color-10.css'
}],
'switcherTarget': $('#changeColorScheme')
});
}
});
/* -------------------------------------------------------------------------*
* BODY SCROLLED
* -------------------------------------------------------------------------*/
var isBodyScrolling = function () {
if ( $wn.scrollTop() > 1 ) {
$body.addClass('scrolling');
} else {
$body.removeClass('scrolling');
}
};
/* -------------------------------------------------------------------------*
* BANNER SLIDER
* -------------------------------------------------------------------------*/
var bannerSliderInit = function () {
var bannerSlider = $('.banner-slider'),
bannerSliderNav = $('.banner--slider-nav'),
bannerSliderPagination = typeof bannerSlider.data('pagination') === 'undefined' ? false : bannerSlider.data('pagination');
if ( bannerSlider.length ) {
bannerSlider.owlCarousel({
slideSpeed: 800,
paginationSpeed: 800,
singleItem: true,
autoPlay: true,
addClassActive : true,
pagination: bannerSliderPagination,
nav: false,
afterInit: function () {
var bannerHeight = bannerSliderNav.length ? $(this.$owlWrapper).outerHeight() + bannerSliderNav.outerHeight() : $(this.$owlWrapper).outerHeight();
$(this.$userItems).css( 'height', parseInt( bannerHeight ) );
$(this.$userItems).css( 'padding-bottom', bannerSliderNav.outerHeight() + 80 );
bannerSliderNav.on('click', 'li', function () {
bannerSlider.trigger( 'owl.goTo', $(this).index() );
});
},
afterMove: function () {
bannerSliderNav.find('li').eq( this.currentItem ).addClass('active').siblings('li').removeClass('active');
}
});
}
};
/* -------------------------------------------------------------------------*
* FUNCTION CALLS
* -------------------------------------------------------------------------*/
$wn
.on('load', bannerSliderInit)
.on('load scroll', isBodyScrolling);
})(jQuery);
$(document).ready(function(){
$(".expand-table").each(function() {
$(this).find('tr').hide().slice(0, 6).show();
var rowCount = $(this).find('tr').length;
var rowCount = rowCount - 1;
$(this).parent().find(".expendbtn").html("Show More ("+rowCount+")");
});
$(document).on("click", '.expendbtn', function() {
if ($(this).text() != "Show Less") {
$(this).parent().prev(".expand-table").find("tr").fadeIn("slow");
$(this).parent().next(".fadeOut").hide("slow");
$(this).html("Show Less");
} else {
$(this).parent().prev(".expand-table").find('tr').slice(6).fadeOut("slow");
$(this).parent().next(".fadeOut").show("slow");
var rowCount = $(this).parent().prev(".expand-table").find('tr').length;
var rowCount = rowCount - 1;
$(this).html("Show More ("+rowCount+")");
}
});
$('html').click(function() {
$('#currency_options').hide();
})
$('#primaryNavbar').click(function(e){
e.stopPropagation();
});
$('#currency_change').click(function(e) {
$('#currency_options').toggle();
});
$(function() {
$('.newsletter-submit').ajaxChimp({
callback: function(response) {
alert('We have added your e-mail to our newsletter!');
}
});
})
});
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-126144072-1');
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/5b883138f31d0f771d844d46/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
$( function() {
$( "#slider-range-price" ).slider({
range: true,
min: 1,
max: 100,
values: [ 1, 100 ],
slide: function( event, ui ) {
$( "#price" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
},
change: function(event, ui) {
$("#filter_form").submit();
}
});
$( "#price" ).val( "$" + $( "#slider-range-price" ).slider( "values", 0 ) +
" - $" + $( "#slider-range-price" ).slider( "values", 1 ) );
$( "#slider-range-disk" ).slider({
range: true,
min: 10,
max: 600,
values: [ 10, 600 ],
slide: function( event, ui ) {
$( "#disk" ).val( "" + ui.values[ 0 ] + "GB - " + ui.values[ 1 ] + "GB" );
},
change: function(event, ui) {
$("#filter_form").submit();
}
});
$( "#disk" ).val( $( "#slider-range-disk" ).slider( "values", 0 ) +
"GB - " + $( "#slider-range-disk" ).slider( "values", 1 ) + "GB" );
$( "#slider-range-cpu" ).slider({
range: true,
min: 0,
max: 4,
values: [ 0, 4 ],
slide: function( event, ui ) {
$( "#cpu" ).val( "" + ui.values[ 0 ] + " CPU - " + ui.values[ 1 ] + " CPU" );
},
change: function(event, ui) {
$("#filter_form").submit();
}
});
$( "#cpu" ).val( $( "#slider-range-cpu" ).slider( "values", 0 ) +
" CPU - " + $( "#slider-range-cpu" ).slider( "values", 1 ) + " CPU" );
$( "#slider-range-ram" ).slider({
range: true,
min: 512,
max: 16384,
values: [ 512, 16384 ],
slide: function( event, ui ) {
$( "#ram" ).val( "" + ui.values[ 0 ] + "MB - " + ui.values[ 1 ] + "MB" );
},
change: function(event, ui) {
$("#filter_form").submit();
}
});
$( "#ram" ).val( $( "#slider-range-ram" ).slider( "values", 0 ) +
"MB - " + $( "#slider-range-ram" ).slider( "values", 1 ) + "MB" );
$( "#slider-range-transfer" ).slider({
range: true,
min: 100,
max: 5000,
values: [ 100, 5000 ],
slide: function( event, ui ) {
$( "#transfer" ).val( "" + ui.values[ 0 ] + "GB - " + ui.values[ 1 ] + "GB" );
},
change: function(event, ui) {
$("#filter_form").submit();
}
});
$( "#transfer" ).val( $( "#slider-range-transfer" ).slider( "values", 0 ) +
"GB - " + $( "#slider-range-transfer" ).slider( "values", 1 ) + "GB" );
$('#filter_form').on('submit', function(e) { //use on if jQuery 1.7+
e.preventDefault(); //prevent form from submitting
var data = $("#filter_form").serializeArray();
$.ajax({
url: "/html/vps_filters.php",
type: "GET",
async: true,
data: $('#filter_form').serialize(),
cache: false,
success: function(result){
document.getElementById('filter_results').innerHTML = result;
var myDiv = document.getElementById('filter_results');
myDiv.scrollTop = 0;
},
error: function(result){ }
});
});
$(document).ready(function() {
$("#slider-range" ).slider({
// options
start: function (event, ui) {
// code
},
slide: function( event, ui ) {
// code
},
change: function(event, ui) {
$("#priceform").submit();
}
});
});
} );
$('#filter_form').change(function(){$('#filter_form').submit();});
$(document).ready(function(){
$("#filter_form").submit();
});
function categorySort(category)
{
if (category == "all") {
$("tbody>tr").css('display', 'table-row');
} else {
$("tbody>tr").css('display', 'none');
$("tbody>tr[data-category='"+category+"']").css('display', 'table-row');
}
}
$(document).ready(function() {
$('a.domain-category').click(function() {
$('a.domain-category').removeClass('btn-custom-active');
$(this).addClass('btn-custom-active');
});
$('.selectable > div.feature--item').click(function() {
$(this).parent().find('div.ca-holder').removeClass('ca-active');
$(this).find('div.ca-holder').addClass('ca-active');
});
$('#location > div.feature--item').click(function() {
$('#results_div').css('display', 'none');
var location = $(this).attr('data-value');
var fd = "location="+location;
$.ajax({
url: "/includes/lg.php",
type: "POST",
async: true,
data: fd,
dataType: 'text',
success: function(result){
var obj = JSON.parse(result);
$("#file_100").find('img').attr("src","/img/countries/large/"+location+".png");
$("#file_1").find('img').attr("src","/img/countries/large/"+location+".png");
$("#file_100").attr("href","https://"+obj[0]+"/100MB.bin");
$("#file_1").attr("href","https://"+obj[0]+"/1GB.bin");
$("#ipv4").html(obj[1]);
$("#ipv6").html(obj[2]);
$("#dns").html(obj[0]);
$("#ipc").html(obj[3]);
$("#ipf").attr("src","/img/countries/large/"+obj[4]+".png");
},
error: function(result){ }
});
});
$('#test_type > div.feature--item').click(function() {
var select = $(this).attr('data-value');
if (select == "download") {
$("#download").css('display', 'block');
$("#tests").css('display', 'none');
} else {
$("#download").css('display', 'none');
$("#tests").css('display', 'block');
}
$('#results_div').css('display', 'none');
});
$("#location > div.feature--item").find('.ca-active').trigger('click');
});
$('#lg').on('submit', function(e) { //use on if jQuery 1.7+
e.preventDefault(); //prevent form from submitting
$('#lg_but').prop('disabled', true);
$('#lg_but > i').css('display', 'inline-block');
$('#results_div').css('display', 'block');
$('#but_text').html('Loading results...');
document.getElementById('results').innerHTML = ' Loading results...';
var location = $('#location > div.feature--item > div.ca-active').parent().attr('data-value');
var type = $('#test_type > div.feature--item > div.ca-active').parent().attr('data-value');
var ip = $('#ip_address').val();
var fd = "location="+location+"&type="+type+"&ip="+ip;
$.ajax({
url: "/includes/lg.php",
type: "POST",
async: true,
data: fd,
dataType: 'text',
success: function(result){
document.getElementById('results').innerHTML = result;
$('#lg_but').prop('disabled', false);
$('#lg_but > i').css('display', 'none');
$('#but_text').html('Start Test');
},
error: function(result){ $('#lg_but').prop('disabled', false); }
});
});