const input = document.querySelector('footer > .i > input') const hints = document.querySelector('.hints') var inputed_room = '' const initEruda = () => { if (window.__zatupsErudaInitialized || !window.eruda) return window.eruda.init() window.__zatupsErudaInitialized = true } input.addEventListener('focus', (e) => { const fixed = `height: ${map.clientHeight}px !important;` document.querySelector('#map').style = fixed document.querySelector('#map > #wr').style = fixed }) input.addEventListener('input', (e) => { console.log(e.target.value) inputed_room = e.target.value.trim().toLowerCase() if (inputed_room === 'eruda') { try {hints.classList.remove('a')} catch {} hints.innerHTML = '' initEruda() return } if (inputed_room.length > 0) { try {hints.classList.add('a')} catch {} const out = fdata.results(inputed_room) if (out.length == 0) { Telegram.WebApp.HapticFeedback.notificationOccurred('error') return hints.innerHTML = `Результатов нет` } hints.innerHTML = out.map(e => `${e.r}`).join('') console.log(inputed_room) } else { try {hints.classList.remove('a')} catch {} hints.innerHTML = '' } }) const sleep = ms => new Promise(r => setTimeout(r, ms)); const find = async (room_name, floor) => { console.log(room_name, floor) input.value = '' input.placeholder = room_name hints.innerHTML = '' try {hints.classList.remove('a')} catch {} if (!room_name.includes('Туал')) { fswitch(floor) await sleep(450) } Telegram.WebApp.HapticFeedback.notificationOccurred('success') highlight(room_name) }