/home/bdqbpbxa/demo-subdomains/adaptiq.goodface.com.ua/frontend/js/script.js
// Preloader
$(document).ready(function () {
if (document.readyState === "complete") {
unlockScroll();
$('.preloader').addClass('-loaded');
$('.preloader').fadeOut(300, function () {
$(this).remove();
});
let hash = window.location.hash;
let hashElement = $(hash);
if (hashElement.length) {
linkScroll(hashElement);
}
}
});
// $(window).on('load', function () {
// if ($('.preloader img').length) {
// lockScroll();
// $('.preloader').addClass('-loaded');
// $('.preloader').fadeOut(300, function () {
// $(this).remove();
// });
// let hash = window.location.hash;
// let hashElement = $(hash);
// if (hashElement.length) {
// linkScroll(hashElement);
// }
// }
// });
// Show file name
$(document).on("change", 'input[type="file"]', function () {
let container = $(this).closest(".-file-input");
let file = $(this).val();
let dataChangeText = container.attr('data-change-text');
let oldText = container.find('label').text();
if (file) {
let fileName = file.split("/").pop().split("\\").pop();
container.find(".fileName").text(fileName);
container.addClass("-file-uploaded");
container.attr('data-change-text', oldText);
container.find('label').html(dataChangeText);
} else {
container.find('.fileName').text(container.data('empty-text'));
container.removeClass("-file-uploaded");
container.attr('data-change-text', oldText);
container.find('label').html(dataChangeText);
}
});
$(document).on('click', '.-file-uploaded label', function (e) {
e.preventDefault();
let container = $(this).closest(".-file-input");
container.find('input').val('').change();
})
// Make work img in testimonials
$(window).on('load', function () {
let zIndex = 100
if ($('.tesimonial-card__user-img').length) {
$('.tesimonial-card__user-img .img').each(function () {
zIndex--;
$(this).css('z-index', zIndex);
})
}
})
// Init testimonials slider
function swipersIsnit() {
let swiperContainer = $(".testimonial-slider");
if (swiperContainer.length) {
let testimonialsSwiper = new Swiper(swiperContainer[0], {
slidesPerView: 1,
spaceBetween: 16,
speed: 900,
autoHeight: true,
loop: true,
navigation: {
nextEl: swiperContainer.find(".swiper__navigation-button.swiper-button-next")[0],
prevEl: swiperContainer.find(".swiper__navigation-button.swiper-button-prev")[0],
},
pagination: {
el: swiperContainer.find(".swiper-pagination")[0],
type: "bullets",
clickable: true,
},
breakpoints: {
760: {
slidesPerView: 'auto',
},
},
});
}
let industrySliderContainer = $('.industry-section__slider');
if (industrySliderContainer.length) {
let industrySlider = new Swiper(industrySliderContainer[0], {
slidesPerView: 'auto',
spaceBetween: 16,
speed: 900,
loop: true,
breakpoints: {
760: {
slidesPerView: 2,
},
1025: {
slidesPerView: 'auto',
},
},
});
}
let mainPageSwiper = $('.main__slider');
if (mainPageSwiper.length) {
let mainPageSlider = new Swiper(mainPageSwiper[0], {
slidesPerView: 1,
effect: 'fade',
speed: 900,
loop: true,
navigation: {
nextEl: mainPageSwiper.find(".swiper__navigation-button.swiper-button-next")[0],
prevEl: mainPageSwiper.find(".swiper__navigation-button.swiper-button-prev")[0],
},
pagination: {
el: mainPageSwiper.find(".swiper-pagination")[0],
type: "bullets",
clickable: true,
},
});
}
let hiringSwiper = $('.hiring-slider');
if (hiringSwiper.length) {
let slideWidth;
let marginRight = 0;
let slidesCount = hiringSwiper.find('.hiring-slide').length;
let progressLine = hiringSwiper.find('.swiper-progress');
const hiringSlider = new Swiper(hiringSwiper[0], {
slidesPerView: 'auto',
spaceBetween: 38,
speed: 600,
breakpoints: {
760: {
slidesPerView: 2,
},
1025: {
slidesPerView: 2,
spaceBetween: 8,
},
},
on: {
init: function (swiper) {
initAndUpdate(swiper);
},
udate: function (swiper) {
initAndUpdate(swiper);
}
}
});
hiringSlider.on('setTranslate', function (swiper, translate) {
if (!isPc) {
if (Math.sign(translate) != '-1' && Math.sign(translate) != '0') return;
translate = Math.abs(translate);
let width;
if (!isMobile) {
width = slideWidth * 2 + translate + marginRight + 8;
} else {
let lineWidth = $('.swiper-progress').innerWidth();
width = slideWidth + translate + marginRight;
if (lineWidth - width < 100 && lineWidth - width > 0) {
width = lineWidth;
}
}
progressLine.find('.-active-line').css({
'width': width,
});
}
});
hiringSlider.on('setTransition', function (swiper, transition) {
if (!isPc) {
progressLine.find('.-active-line').css({
'transition-duration': transition + 'ms',
});
}
});
hiringSlider.on('update', function (swiper) {
slideWidth = swiper.slidesSizesGrid[0];
})
$(window).on('resize', function () {
hiringSlider.setTranslate();
hiringSlider.setTransition();
hiringSlider.update();
})
// Hiring slider future
function setSlideHeight() {
$('.hiring-slide').each(function () {
let textContainer = $(this).find('.hiring-slide__content-container');
let textWrapper = $(this).find('.hiring-slide__content-wrapper');
if (!textContainer.hasClass('-active')) {
let realTextHeight = textWrapper.innerHeight();
let containerHeight = textContainer.attr('data-max-height');
if (realTextHeight > containerHeight) {
textContainer.attr('style', '');
textContainer.addClass('-hidden');
}
}
});
}
function initAndUpdate(swiper) {
slideWidth = swiper.slidesSizesGrid[0];
$('.hiring-slide').each(function (index) {
$(this).find('.hiring-slide__title-number .number').html($(this).index());
if (index == 0) {
marginRight = Number($(this).css('margin-right').slice(0, -2));
}
})
let progressBarWidth = slidesCount * swiper.slidesSizesGrid[0];
if (isMobile) {
progressBarWidth = progressBarWidth + (marginRight * slidesCount) - marginRight;
}
if (!isPc) {
if (isMobile) {
progressLine.find('.-active-line').css('width', Number(slideWidth + marginRight) + 'px');
} else {
progressLine.find('.-active-line').css('width', Number(slideWidth * 2 + marginRight) + 'px');
}
}
grogresLineInfinite = progressBarWidth + 5000
progressLine.css('width', grogresLineInfinite + 'px');
setSlideHeight();
}
// Hiring slider future
$('.hiring-slide .link').on('click', function () {
let textContainer = $(this).closest('.hiring-slide').find('.hiring-slide__content-container');
let textWrapper = $(this).closest('.hiring-slide').find('.hiring-slide__content-wrapper');
let link = $(this);
let linkNewText = link.attr('data-change-text');
let linkOldText = link.text();
link.text(linkNewText);
link.attr('data-change-text', linkOldText);
if (textContainer.hasClass('-hidden')) {
let realTextHeight = textWrapper.innerHeight();
textContainer.attr('data-height-before', textContainer.innerHeight());
textContainer.css('height', realTextHeight);
textContainer.removeClass('-hidden');
textContainer.addClass('-active');
} else {
let beforeHeight = textContainer.attr('data-height-before');
textContainer.css('height', beforeHeight);
textContainer.addClass('-hidden');
textContainer.removeClass('-active');
}
});
$(window).on('resize', function () {
$('.hiring-slide').each(function () {
let textContainer = $(this).find('.hiring-slide__content-container');
let textWrapper = $(this).find('.hiring-slide__content-wrapper');
if (textContainer.hasClass('-active')) {
let realTextHeight = textWrapper.innerHeight();
let containerHeight = textContainer.attr('data-max-height');
if ((realTextHeight > containerHeight || realTextHeight < containerHeight) && textContainer.attr(
'style') != '') {
textContainer.css('height', realTextHeight);
}
}
})
setSlideHeight();
})
let eventObj;
function checkCursorPosition() {
let event = window.event;
eventObj = event;
let scrollTop = $(document).scrollTop();
let cursorPositionY = event.pageY - scrollTop;
let cursorPositionX = event.pageX
let slider = hiringSwiper;
let sliderTopPosition = slider[0].getBoundingClientRect().top;
let sliderLeftPosition = slider[0].getBoundingClientRect().left;
let sliderBottomPosition = sliderTopPosition + slider.innerHeight();
if (cursorPositionY > sliderTopPosition && sliderBottomPosition > cursorPositionY) {
let lineWidth = cursorPositionX - sliderLeftPosition;
let sliderTransform = slider.find('.swiper-wrapper').css('transform').split(',')[4];
if (Math.sign(sliderTransform) == -1) {
lineWidth = lineWidth + Math.abs(sliderTransform);
}
$('.-active-line').css('width', lineWidth);
slider.find('.swiper-slide').each(function () {
let slideOffsetLeft = $(this)[0].getBoundingClientRect().left;
if (cursorPositionX > slideOffsetLeft) {
$(this).addClass('-is-active');
} else {
$(this).removeClass('-is-active');
}
})
}
}
$(document).on('mousemove', checkCursorPosition);
}
}
$(window).on("load", swipersIsnit);
// Make work Clients card on mobile
$(document).on('click', '.client-card .mobile-icon', function () {
$(this).closest('.client-card').toggleClass('-active');
})
// Make work client borders
let previousOffsetTop = 0;
let previousOffsetLeft = 0;
function MakeClientBorder() {
$('.client-card').each(function (index) {
let thisEl = $(this);
let thisOffsetTop = thisEl.offset().top;
thisEl.removeClass('-border-left');
thisEl.removeClass('-border-top');
if (isPc) {
if (index == 0) {
previousOffsetTop = thisOffsetTop;
} else {
if (thisOffsetTop != previousOffsetTop) {
thisEl.addClass('--border-wrapper');
thisEl.prepend('<span class="--border-top --horizontal-border"></span>');
}
let prevEl = $(this).prev();
if (prevEl.offset().top == thisOffsetTop) {
thisEl.addClass('--border-wrapper');
thisEl.prepend('<span class="--border-left --vertical-border"></span>');
}
}
} else {
if (index != 0) {
thisEl.addClass('--border-wrapper');
thisEl.prepend('<span class="--border-bottom --horizontal-border"></span>');
} else {
thisEl.addClass('--border-wrapper');
thisEl.prepend('<span class="--border-bottom --horizontal-border"></span>');
thisEl.prepend('<span class="--border-top --horizontal-border"></span>');
}
}
})
}
$(window).on('load resize', MakeClientBorder);
// Make work sticky slider
function stickyMaker() {
let allstickyBlocks = $('.sticky-block').length;
if (allstickyBlocks) {
let list = $('.sticky-list');
let visiblePartHeightObj = list.data('visible-part-height').split([',']);
let visiblePartHeighPC = Number(visiblePartHeightObj[0]);
let visiblePartHeighMob = Number(visiblePartHeightObj[1]);
let visiblePartHeight;
if (isPc) {
visiblePartHeight = visiblePartHeighPC;
} else {
visiblePartHeight = visiblePartHeighMob;
}
let allstickyBlocksHeight = window.innerHeight - (allstickyBlocks * visiblePartHeight) + visiblePartHeight;
$('.sticky-block').each(function (index) {
allstickyBlocks--;
let offsetPreBlock = visiblePartHeight * index;
let offsetBottom = visiblePartHeight * allstickyBlocks;
$(this).find('.sticky-block__number').html(index + 1);
if (isPc) {
$(this).css({
'height': allstickyBlocksHeight,
'top': offsetPreBlock,
'margin-top': offsetPreBlock,
'margin-bottom': allstickyBlocks * visiblePartHeight,
'bottom': -allstickyBlocksHeight + offsetBottom + visiblePartHeight,
});
} else {
$(this).css({
'height': window.innerHeight,
'top': 0,
'margin-top': 0,
});
}
})
}
}
$(window).on('load', stickyMaker);
// Fixed header on scroll
let lastScroll = 0;
$(window).on("scroll", function () {
let header = $(".header");
let scrollTop = $(window).scrollTop();
if (scrollTop > 0) {
header.addClass("-has-bg");
} else {
if (!$("body").hasClass("-scroll-lock")) {
header.removeClass("-has-bg");
}
}
if (!$('.-delete-after-animate').length) {
if (scrollTop > lastScroll) {
if (scrollTop - lastScroll === scrollTop || scrollTop <= 0) {} else {
header.addClass("-hide");
}
} else {
let stickyFirstBlock = $('.sticky-list .sticky-block:first-child');
if (stickyFirstBlock.length) {
let stickyBlockPosition = stickyFirstBlock[0].getBoundingClientRect().top;
if (stickyBlockPosition == 0 || (stickyBlockPosition > -100 && stickyBlockPosition < 100)) {
header.addClass("-hide");
} else {
header.removeClass("-hide");
}
} else {
header.removeClass("-hide");
}
}
}
lastScroll = scrollTop;
});
$(window).on("load", function () {
window.scroll();
});
// Make the last point in heading-1 red
function MakePointRed() {
let el = $('.--red-dot, .editor h1, .editor h2');
if (el.length) {
el.each(function () {
let thisText = $(this).html().trim();
let last = thisText.slice(-1);
if (last == '.') {
let newString = thisText.substring(0, thisText.length - 1) + "<span class='--red-color'>.</span>";
$(this).html(newString);
}
})
}
}
$(window).on('load', MakePointRed);
// Make work interactive map
$(document).on('click', '.clickable-zone', function () {
clickableMapToAccordion($(this));
})
$(document).on('click', '.map-acordion', function () {
clickableAccordionToMap($(this));
})
function clickableAccordionToMap(el) {
let container = el.closest('.--accordion');
let countryName = container.attr('data-country-name');
let country = el.closest('.locations-wrapper').find(`.country[data-country-name="${countryName}"]`);
let previousActiveCountry = $('.country.-active');
previousActiveCountry.removeClass('-active');
if (container.hasClass('-open')) {
country.addClass('-active');
} else {
country.removeClass('-active');
}
}
function clickableMapToAccordion(el) {
let container = el.closest('.country');
let countryName = container.attr('data-country-name');
let acordion = el.closest('.locations-wrapper').find(
`.map-acordion[data-country-name="${countryName}"] .--accordion__open`);
acordion.click();
}
// Make work team
let teamPreviousOffsetTop = 0;
let teamPreviousClass = false;
function MakeTeamGrid() {
$('.team-small-list .img').each(function (index) {
let thisEl = $(this);
let thisOffsetTop = thisEl.offset().top;
thisEl.removeClass('-circled');
let changeEl = false;
if (!isPc) {
if (thisEl.hasClass('-mobile-hidden')) {
changeEl = true;
} else {
changeEl = false;
}
}
if (!changeEl) {
if (index == 0) {
previousOffsetTop = thisOffsetTop;
teamPreviousClass = false;
} else {
if (thisOffsetTop != previousOffsetTop) {
if (teamPreviousClass) {
thisEl.addClass('-circled');
teamPreviousClass = '-circled';
} else {
teamPreviousClass = false;
}
} else {
if (!teamPreviousClass) {
thisEl.addClass('-circled');
teamPreviousClass = '-circled';
} else {
teamPreviousClass = false;
}
}
}
previousOffsetTop = thisOffsetTop;
}
})
}
$(window).on('load resize', MakeTeamGrid);
// Copy link
let copiedLink = false;
$("[data-copied-text]").on("click", function () {
// if (copiedLink) return;
// copiedLink = true;
// const getCopyItem = $(this).attr("data-copy");
// navigator.clipboard.writeText(getCopyItem);
var copyText = $(this).attr('data-copy');
let copyInput = '<input id="copyInput" value="' + copyText + '">';
$(this).addClass("-copied");
$('body').append(copyInput);
document.getElementById('copyInput').select();
document.execCommand('copy');
setTimeout(() => {
copiedLink = false;
$(this).removeClass("-copied");
}, 1500);
$('#copyInput').remove();
});
$('.cube-acordion .--accordion__open').click(function () {
let container = $(this).closest('.--accordion');
let index = container.index();
let cube = container.closest('.discovery-wrapper').find('.cube__wrapper .img').eq(index);
let cubeHeight = cube.innerHeight();
$('.cube__wrapper').css('height', cubeHeight);
if (cube.hasClass('-active')) {
return;
} else {
$('.cube__wrapper .img.-active').removeClass('-active');
cube.addClass('-active');
}
})
$(window).on('load', function () {
let cube = $('.discovery-wrapper').find('.cube__wrapper .img').eq(0);
let cubeHeight = cube.innerHeight();
$('.cube__wrapper').css('height', cubeHeight);
})
// Video youtube insert
$(document).on('click', '.video', function () {
let videoContainer = $(this);
let containerForVideo = $(this).find('.video__wrapper');
insertYoutubeIframe(videoContainer, containerForVideo);
})
function insertYoutubeIframe(videoContainer, iframePlacedContainer) {
let videoSrc = videoContainer.data('href');
iframePlacedContainer.html(
`<iframe src = "https://www.youtube.com/embed/${videoSrc}?rel=0&showinfo=0&autoplay=1" frameBorder="0" allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen> </iframe>`
)
}
// Number
$('.-numbered-title h1, .-numbered-title h2, .-numbered-title h3, .-numbered-title h4, .-numbered-title h5, .-numbered-title h6')
.each(function (index) {
let number = index + 1;
$(this).prepend(`<span class="-number">${number}</span>`);
})
// Make work main page cubes
function cubePositionSet() {
let cubeContainer = $('.main__img');
if (cubeContainer.length) {
let offsetXperCube = cubeContainer.data('x-offset');
let offsetYperCube = cubeContainer.data('y-offset');
let offsetperRow = cubeContainer.data('offset-per-row');
let offsetYperLvl = cubeContainer.data('y-offset-per-lvl');
let offsetXperLvl = cubeContainer.data('x-offset-per-lvl');
let zIndex = 30;
cubeContainer.find('.cube').each(function (index) {
let el = $(this);
let thisCol = $(this).attr('data-col');
let thisRow = $(this).attr('data-row');
let thisLvl = $(this).attr('data-lvl');
let translateY = offsetYperCube * (thisCol - 1) + 36;
let translateX = offsetXperCube * (thisRow - 1) + 51;
if (thisRow != 1) {
translateY = translateY - (offsetperRow * (thisRow - 1));
}
if (thisLvl != 1) {
translateY = translateY + (offsetYperLvl * (thisLvl - 1));
translateX = translateX + (offsetXperLvl * (thisLvl - 1));
}
if (Math.sign(translateY) == '-1') {
translateY = Math.abs(translateY);
} else {
translateY = "-" + translateY;
}
if (el.hasClass('-red-cube')) {
el.css({
'z-index': 10 - thisLvl,
});
el.attr('data-x-final', translateX + '%');
el.attr('data-y-final', translateY + '%');
el.attr('data-rotation-final', '0');
} else {
el.css({
'transform': `translate(${translateX}%, ${translateY}%) scale(0.94)`,
'z-index': 10 - thisLvl,
});
}
let translateYFinal = Number(translateY) + 36;
let translateXFinal = Number(translateX) - 51;
el.attr('data-x-final', translateXFinal + '%');
el.attr('data-y-final', translateYFinal + '%');
el.attr('data-rotation-final', '0');
})
}
}
$(window).on('load resize', cubePositionSet);
// Filter counter
$(document).on("click", ".--dropdown__list-item .--checkbox .visible-part", function () {
updateCheckedCount($(this));
});
function updateCheckedCount(element) {
const getDropdown = element.closest(".--dropdown");
const getButtonText = getDropdown.find(".--dropdown__value-text");
let getNumberPlace = getButtonText.find("span");
const getAllCheckbox = getDropdown.find(
".--checkbox.-checked"
);
const getAllCheckboxLength = getAllCheckbox.length;
if (!getNumberPlace.length) {
getButtonText.append(" <span></span>");
getNumberPlace = getButtonText.find("span");
}
if (getAllCheckboxLength === 0) {
getDropdown.removeClass('-has-active-filter');
getNumberPlace.remove();
} else {
getDropdown.addClass('-has-active-filter');
getNumberPlace.text(`(${getAllCheckboxLength})`);
}
}
// Custom scrollbar initialization
$(document).ready(function () {
if ($(".--custom-scrollbar").length) {
$(".--custom-scrollbar").each(function () {
$(this).overlayScrollbars({
className: "os-theme-dark",
scrollbars: {
clickScrolling: true,
},
});
});
}
});
$(document).on('click', '.apply-link', function () {
$('.--tabs-container__menu').find('.--tabs-container__menu-item').eq(0).click();
})
$(document).on('click', '.recomend-link', function () {
$('.--tabs-container__menu').find('.--tabs-container__menu-item').eq(1).click();
})
$(window).on('load resize', addWidthToTitleArrow)
function addWidthToTitleArrow() {
if (isPc) {
$('.position-card .title').each(function () {
let spanWidth = $(this).find('span:not(.-arrow)').innerWidth() + 8;
$(this).find('.-arrow').css('left', spanWidth);
})
}
}
// Makes the height of the left part of the content the same as the height of the form tabs
function stickyVacancy() {
if ($('.form-tabs').length && isPc) {
let fromBlocks = $('.form-tabs');
let leftPart = $('.article__left');
let fromBlocksHeight = fromBlocks.innerHeight();
let leftPartHeight = leftPart.innerHeight();
let leftPartHeaderHeight = leftPart.find('.job-main-description__left').innerHeight();
let readyHeight = fromBlocksHeight + leftPartHeaderHeight + 1;
if (leftPartHeight != readyHeight) {
leftPart.css('min-height', readyHeight);
}
}
}
// Make sticky border smaller when scrolling
function smallerBorderOnScroll() {
if ($('.form-tabs').length && isPc) {
let fromBlocks = $('.form-tabs');
let leftPart = $('.article__left');
let leftPartOffset = leftPart[0].getBoundingClientRect().top;
let fromBlocksOffset = fromBlocks[0].getBoundingClientRect().top;
if (leftPartOffset == 100 && fromBlocksOffset != leftPartOffset) {
leftPart.addClass('-fixed');
} else {
leftPart.removeClass('-fixed');
}
}
}
$(window).on('load resize', stickyVacancy);
$(window).on('load scroll resize', smallerBorderOnScroll);
$(document).on('ready', function () {
if ($('input.page_name').length) {
let title = $('input.page_name').closest('.form').attr('data-page-title');
$('input.page_name').val(title).change();
}
})
$(document).ready(function () {
if ($(".vacancy-title").length) {
$(".vacancy-title").each(function () {
let title = $(this).closest('.form').attr('data-page-title');
$(this).val(title).change();
})
}
});
$(window).on('load', countSlides($('.-slides-count')));
function countSlides(el) {
let section = el.closest('section');
let slidesToCount = section.find('.count-this-slide');
el.find('sup').text(slidesToCount.length);
}
// Drug cursor on industry slider
// let eventObj;
// function checkCursorPosition() {
// let event = window.event;
// eventObj = event;
// let scrollTop = $(document).scrollTop();
// let cursorPositionY = event.pageY - scrollTop;
// let cursorPositionX = event.pageX
// let slider = $('.industry-section__slider');
// let sliderTopPosition = slider[0].getBoundingClientRect().top;
// let sliderBottomPosition = sliderTopPosition + slider.innerHeight();
// if (cursorPositionY > sliderTopPosition && sliderBottomPosition > cursorPositionY) {
// $('.drag-cursor').css('transform', `translate(${cursorPositionX}px, ${cursorPositionY}px)`);
// }
// }
// $(document).on('mousemove', checkCursorPosition);