bind arrows only once
This commit is contained in:
parent
4b4990b123
commit
311178d16d
40
main.js
40
main.js
@ -426,7 +426,7 @@
|
||||
}
|
||||
|
||||
let makeCoordinatesLinks = (function () {
|
||||
var executed = false
|
||||
let executed = false
|
||||
return function () {
|
||||
if (executed) return
|
||||
executed = true
|
||||
@ -697,7 +697,7 @@
|
||||
}
|
||||
|
||||
let prettifyFiles = (function () {
|
||||
var executed = false
|
||||
let executed = false
|
||||
return function (insertedFileRows) {
|
||||
if (executed) return
|
||||
executed = true
|
||||
@ -952,23 +952,29 @@
|
||||
bindArrowsForGallery('.swiper-button-prev', '.swiper-button-next')
|
||||
}
|
||||
|
||||
function bindArrowsForGallery(leftButtonQuery, rightButtonQuery) {
|
||||
document.addEventListener("keydown", function (e) {
|
||||
if (!document.querySelector("dialog").open) return
|
||||
switch (e.key) {
|
||||
case "ArrowLeft":
|
||||
document.querySelector(leftButtonQuery).click()
|
||||
break
|
||||
const bindArrowsForGallery = (function () {
|
||||
let executed = false
|
||||
return function(leftButtonQuery, rightButtonQuery) {
|
||||
if (executed) return
|
||||
executed = true
|
||||
|
||||
case "ArrowRight":
|
||||
document.querySelector(rightButtonQuery).click()
|
||||
break
|
||||
document.addEventListener("keydown", function (e) {
|
||||
if (!document.querySelector("dialog").open) return
|
||||
switch (e.key) {
|
||||
case "ArrowLeft":
|
||||
document.querySelector(leftButtonQuery).click()
|
||||
break
|
||||
|
||||
default: return
|
||||
}
|
||||
e.preventDefault()
|
||||
})
|
||||
}
|
||||
case "ArrowRight":
|
||||
document.querySelector(rightButtonQuery).click()
|
||||
break
|
||||
|
||||
default: return
|
||||
}
|
||||
e.preventDefault()
|
||||
})
|
||||
}
|
||||
})()
|
||||
|
||||
async function sendForm() {
|
||||
let formData = new FormData(document.querySelector("form"))
|
||||
|
Loading…
Reference in New Issue
Block a user