1export const init100vh = () => { 2 let vh = window.innerHeight * 0.01; 3 4 (function init100vh() { 5 function setHeight() { 6 var vh = window.innerHeight * 0.01; 7 document.documentElement.style.setProperty("--vh", `${vh}px`); 8 } 9 setHeight(); 10 window.addEventListener("resize", setHeight); 11 })(); 12}; 13 14function cookie() { 15 var time = new Date(); 16 localStorage.timeTrue = +new Date(); 17 18 if (Number(localStorage.timeTrue) > Number(localStorage.time)) { 19 localStorage.test = 0; 20 } 21 22 const cookie = document.querySelector(".cookie_js"); 23 24 if (Number(localStorage.test) != 1) { 25 cookie.classList.remove("active"); 26 } else { 27 cookie.classList.add("active"); 28 } 29 30 document.addEventListener("click", (e) => { 31 let btn = e.target.closest(".cookie-btn_js"); 32 33 if (btn) { 34 localStorage.time = time.setDate(time.getDate() + 1); 35 localStorage.test = 1; 36 37 cookie.classList.add("active"); 38 } 39 }); 40} 41 42function phoneMask() { 43 [].forEach.call(document.querySelectorAll(".phone_js"), function (input) { 44 let keyCode; 45 function mask(event) { 46 event.keyCode && (keyCode = event.keyCode); 47 let pos = this.selectionStart; 48 if (pos < 3) event.preventDefault(); 49 let matrix = "+998 (__) ___-__-__", 50 i = 0, 51 def = matrix.replace(/\D/g, ""), 52 val = this.value.replace(/\D/g, ""), 53 newValue = matrix.replace(/[_\d]/g, function (a) { 54 return i < val.length ? val.charAt(i++) || def.charAt(i) : a; 55 }); 56 i = newValue.indexOf("_"); 57 if (i != -1) { 58 i < 5 && (i = 3); 59 newValue = newValue.slice(0, i); 60 } 61 let reg = matrix 62 .substr(0, this.value.length) 63 .replace(/_+/g, function (a) { 64 return "\\d{1," + a.length + "}"; 65 }) 66 .replace(/[+()]/g, "\\$&"); 67 reg = new RegExp("^" + reg + "$"); 68 if ( 69 !reg.test(this.value) || 70 this.value.length < 5 || 71 (keyCode > 47 && keyCode < 58) 72 ) 73 this.value = newValue; 74 if (event.type == "blur" && this.value.length < 5) this.value = ""; 75 } 76 77 input.addEventListener("input", mask, false); 78 input.addEventListener("focus", mask, false); 79 input.addEventListener("blur", mask, false); 80 input.addEventListener("keydown", mask, false); 81 input.addEventListener("mouseup", (event) => { 82 event.preventDefault(); 83 if (input.value.length < 4) { 84 input.setSelectionRange(4, 4); 85 } else { 86 input.setSelectionRange(input.value.length, input.value.length); 87 } 88 }); 89 }); 90} 91 92cookie(); 93phoneMask();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.