add eruda console to map

This commit is contained in:
синечка ♡ 2026-09-09 15:11:39 +00:00
parent 84a82632b3
commit 82cfdb1835
4 changed files with 26 additions and 4 deletions

9
web/common/eruda.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Карта</title>
<script src="../common/telegram.js"></script>
<script src="../common/eruda.min.js"></script>
<link rel="stylesheet" href="./styles/main.css?v12">
</head>
<body>
@ -50,4 +51,4 @@
window.Telegram.WebApp.expand()
</script>
</body>
</html>
</html>

View file

@ -2,6 +2,12 @@ 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
@ -10,7 +16,13 @@ input.addEventListener('focus', (e) => {
input.addEventListener('input', (e) => {
console.log(e.target.value)
inputed_room = e.target.value.toLowerCase()
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)
@ -41,4 +53,4 @@ const find = async (room_name, floor) => {
}
Telegram.WebApp.HapticFeedback.notificationOccurred('success')
highlight(room_name)
}
}

View file

@ -2,7 +2,7 @@
/* Telegram injects these variables inside its WebApp. Keep a light theme
for a normal browser, where that injection is absent. */
color-scheme: light;
--tg-theme-bg-color: #ffffff;
--tg-theme-bg-color: #e5e5ea;
--tg-theme-text-color: #000000;
--tg-theme-hint-color: #707579;
--tg-theme-secondary-bg-color: #f1f1f1;