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 targetDate = new Date(Date.parse('2021-05-17T00:00:00')); // установить дату обратного отсчета | |
const targetDate = new Date(2021, 4, 16); // установить дату обратного отсчета | |
let days; let hours; let minutes; let seconds; // переменные для единиц времени | |
let interval = null; | |
const countdown = document.querySelector('.stock-timer-js'); // получить элемент тега | |
const addZero = (n) => { | |
return (n < 10 ? '0' : '') + n; | |
}; |
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
<div class="custom-select active"> | |
<div class="custom-select__title">Санкт-Петербург</div> | |
<div class="custom-select__content"> | |
<input id="singleSelect0" type="radio" name="city" value="spb" checked /> | |
<label for="singleSelect0" class="custom-select__label">Санкт-Петербург</label> | |
<input id="singleSelect1" type="radio" name="city" value="moscow" /> | |
<label for="singleSelect1" class="custom-select__label">Москва</label> | |
<input id="singleSelect2" type="radio" name="city" value="vasuki" /> | |
<label for="singleSelect2" class="custom-select__label">Новые Васюки</label> | |
<input id="singleSelect3" type="radio" name="city" value="samara" /> |
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
<fieldset class="rating"> | |
<legend class="visually-hidden">Звездный рейтинг</legend> | |
<input id="film-1" type="radio" name="film" value="1"> | |
<input id="film-2" type="radio" name="film" value="2"> | |
<input id="film-3" type="radio" name="film" value="3"> | |
<input id="film-4" type="radio" name="film" value="4" checked> | |
<input id="film-5" type="radio" name="film" value="5"> | |
<label for="film-5" aria-label="5 звезд"> | |
<svg width="44" height="43"> |
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 showPassword = (btn) => { | |
const input = btn.parentElement.querySelector('input'); | |
if (btn.classList.contains('show')) { | |
btn.classList.remove('show'); | |
input.type = 'password'; | |
} else { | |
btn.classList.add('show'); | |
input.type = 'text'; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Slider Demo</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<wc-slider min="50" max="200" step="0" value="100"></wc-slider> |
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 Template from './template.js'; | |
export default class Dbrange extends HTMLElement { | |
constructor() { | |
super(); | |
this.root = this.attachShadow({mode: 'open'}); | |
this.root.innerHTML = Template.render(); | |
this.dom = Template.mapDOM(this.root); | |
this.eventNames = { | |
pointerdown: 'pointerdown', |
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
input.addEventListener('keypress', function(e) { | |
if(/\D/.test(e.key)) { | |
e.preventDefault(); | |
} | |
const len = input.value.length; | |
if(len === 1 || len === 4) { | |
setTimeout(() => { | |
input.value += '/'; | |
}) |