This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const focusableEls = `a[href]:not(:disabled), input:not(:disabled):not([type="hidden"]), | |
select:not(:disabled), textarea:not(:disabled), button:not(:disabled), [contenteditable], | |
[tabindex]:not([tabindex="-1"])`; | |
const isTouchSupported = () => ('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch); | |
const getHtmlElement = (selector, ctx = document) => { | |
const node = typeof selector === 'string' ? ctx.querySelector(selector) : selector; | |
if (node instanceof HTMLElement) { | |
return node; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
const fileLoaderContainers = document.querySelectorAll('.file-loader'); | |
const renderFileLoader = function(fileLoaderContainer) { | |
const wrapper = fileLoaderContainer.querySelector('.file-loader__wrapper'); | |
const btnAdd = fileLoaderContainer.querySelector('.js-fileloader-open'); | |
if (!wrapper || !btnAdd) { | |
return; | |
} | |
const inputFileLoader = wrapper.querySelector('.file-loader__item'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const changeTab = (currentTab) => { | |
const emptyEl = document.createElement('div'); | |
const tabContainer = currentTab.closest('.tab-container'); | |
if (!tabContainer) return; | |
const activeTab = tabContainer.querySelector('.tab-title[aria-selected="true"]') || emptyEl; | |
activeTab.removeAttribute('aria-selected'); | |
activeTab.setAttribute('tabindex', '-1'); | |
currentTab.setAttribute('aria-selected', 'true'); | |
currentTab.removeAttribute('tabindex'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const easingOutQuint = (x, t, b, c, d) => c * ((t = t / d - 1) * t * t * t * t + 1) + b; | |
const makeScroll = (node, value, key = 'scrollTop') => { | |
let startTime = null; | |
const offset = node[key]; | |
const gap = value - offset; | |
const duration = 1000; | |
const step = (t) => { | |
if (!startTime) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const tooltipToggle = (btn) => { | |
const content = btn.nextElementSibling; | |
if (!content) return; | |
content.classList.toggle('active'); | |
if (content.classList.contains('active')) { | |
const closeContent = ({target}) => { | |
if (!content.contains(target) ) { | |
content.classList.remove('active'); | |
document.removeEventListener('click', closeContent); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ResizeObserver from 'resize-observer-polyfill'; | |
export class RotateNumber { | |
constructor(selector) { | |
this.$el = typeof selector === 'string' ? document.querySelector(selector) : selector; | |
if (!(this.$el instanceof HTMLElement)) { | |
return; | |
} | |
this.digits = this.$el.querySelectorAll('.payout__container'); | |
this.maxNumberValue = 9; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const accordionToggle = (selector) => { | |
const accordion = document.querySelector(selector); | |
if (!accordion) return; | |
let previousContent = null; | |
let previousTitle = null; | |
accordion.addEventListener('click', (e) => { | |
const accTitle = e.target.closest('.accordion__title'); | |
if (accTitle) { | |
const accContent = accTitle.nextElementSibling; | |
if (previousContent) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {onFocusPhoneInput} from './onFocusPhoneInput'; | |
const validationData = {}; | |
const urlData = 'data/sendForm.json'; | |
fetch(urlData).then((res) => res.json()).then((res) => { | |
Object.assign(validationData, res); | |
}).catch(() => {}); | |
/*const getDataFromJson = function(url) { | |
const xhr = new XMLHttpRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class Range { | |
constructor(selector) { | |
this.$el = this.getHtmlElement(selector); | |
if (!this.$el) return; | |
this.min = +this.$el.dataset.min ?? 0; | |
this.max = +this.$el.dataset.max ?? 100; | |
this.dom = this.mapDOM(this.$el); | |
this.eventNames = { | |
pointerdown: 'pointerdown', | |
pointermove: 'pointermove', |
NewerOlder