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"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Карта</title> <title>Карта</title>
<script src="../common/telegram.js"></script> <script src="../common/telegram.js"></script>
<script src="../common/eruda.min.js"></script>
<link rel="stylesheet" href="./styles/main.css?v12"> <link rel="stylesheet" href="./styles/main.css?v12">
</head> </head>
<body> <body>

View file

@ -2,6 +2,12 @@ const input = document.querySelector('footer > .i > input')
const hints = document.querySelector('.hints') const hints = document.querySelector('.hints')
var inputed_room = '' var inputed_room = ''
const initEruda = () => {
if (window.__zatupsErudaInitialized || !window.eruda) return
window.eruda.init()
window.__zatupsErudaInitialized = true
}
input.addEventListener('focus', (e) => { input.addEventListener('focus', (e) => {
const fixed = `height: ${map.clientHeight}px !important;` const fixed = `height: ${map.clientHeight}px !important;`
document.querySelector('#map').style = fixed document.querySelector('#map').style = fixed
@ -10,7 +16,13 @@ input.addEventListener('focus', (e) => {
input.addEventListener('input', (e) => { input.addEventListener('input', (e) => {
console.log(e.target.value) 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) { if (inputed_room.length > 0) {
try {hints.classList.add('a')} catch {} try {hints.classList.add('a')} catch {}
const out = fdata.results(inputed_room) const out = fdata.results(inputed_room)

View file

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