make eruda trigger reliable
This commit is contained in:
parent
82cfdb1835
commit
bb50c3e199
2 changed files with 33 additions and 7 deletions
|
|
@ -5,8 +5,8 @@
|
||||||
<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>
|
<script src="../common/eruda.min.js?v13"></script>
|
||||||
<link rel="stylesheet" href="./styles/main.css?v12">
|
<link rel="stylesheet" href="./styles/main.css?v13">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section id="block">
|
<section id="block">
|
||||||
|
|
@ -44,8 +44,8 @@
|
||||||
<!-- <button onclick="footerfind()">Найти</button> -->
|
<!-- <button onclick="footerfind()">Найти</button> -->
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="./js/footer.js?v12"></script>
|
<script src="./js/footer.js?v13"></script>
|
||||||
<script src="./js/map.js?v12"></script>
|
<script src="./js/map.js?v13"></script>
|
||||||
<script>mapload()</script>
|
<script>mapload()</script>
|
||||||
<script>
|
<script>
|
||||||
window.Telegram.WebApp.expand()
|
window.Telegram.WebApp.expand()
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,35 @@ const hints = document.querySelector('.hints')
|
||||||
var inputed_room = ''
|
var inputed_room = ''
|
||||||
|
|
||||||
const initEruda = () => {
|
const initEruda = () => {
|
||||||
if (window.__zatupsErudaInitialized || !window.eruda) return
|
if (window.__zatupsErudaInitialized || window.__zatupsErudaLoading) return
|
||||||
|
|
||||||
|
const start = () => {
|
||||||
|
if (!window.eruda) {
|
||||||
|
hints.innerHTML = '<span>Консоль не загрузилась</span>'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
window.eruda.init()
|
window.eruda.init()
|
||||||
window.__zatupsErudaInitialized = true
|
window.__zatupsErudaInitialized = true
|
||||||
|
} catch (error) {
|
||||||
|
hints.innerHTML = '<span>Консоль не загрузилась</span>'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window.eruda) return start()
|
||||||
|
|
||||||
|
window.__zatupsErudaLoading = true
|
||||||
|
const script = document.createElement('script')
|
||||||
|
script.src = '../common/eruda.min.js?v13'
|
||||||
|
script.onload = () => {
|
||||||
|
window.__zatupsErudaLoading = false
|
||||||
|
start()
|
||||||
|
}
|
||||||
|
script.onerror = () => {
|
||||||
|
window.__zatupsErudaLoading = false
|
||||||
|
hints.innerHTML = '<span>Консоль не загрузилась</span>'
|
||||||
|
}
|
||||||
|
document.head.appendChild(script)
|
||||||
}
|
}
|
||||||
|
|
||||||
input.addEventListener('focus', (e) => {
|
input.addEventListener('focus', (e) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue