create send button
This commit is contained in:
parent
73b1a3b24f
commit
aa98770385
37
main.js
37
main.js
@ -335,6 +335,23 @@
|
||||
return `https://${adminSite}/competitions/${getCompetition()}/relations`
|
||||
}
|
||||
|
||||
function createPseudoButton(button, callback) {
|
||||
let pseudoButton = Tag.button({
|
||||
type: "button",
|
||||
textContent: button.value,
|
||||
classes: [...button.classList].join(" ") + " pseudo-save",
|
||||
on: {
|
||||
click: async () => {
|
||||
await callback()
|
||||
button.click()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
button.style.display = "none"
|
||||
button.parentElement.insertBefore(pseudoButton, button)
|
||||
}
|
||||
|
||||
function copyCoordinates() {
|
||||
let copyButton = Tag.button({
|
||||
classes: "copy-button",
|
||||
@ -2162,22 +2179,14 @@
|
||||
}
|
||||
|
||||
function sendRouteData() {
|
||||
let sendButton = Tag.button({
|
||||
textContent: "Отправить",
|
||||
type: "button",
|
||||
on: {
|
||||
click: async () => {
|
||||
let formData = new FormData(document.querySelector(`form[name="main_form"]`))
|
||||
createPseudoButton(document.querySelector(`input[name="save_sort"]`), async () => {
|
||||
let formData = new FormData(document.querySelector(`form[name="main_form"]`))
|
||||
|
||||
let catId = urlParams().get("cat_id")
|
||||
formData.set("cat_id", catId)
|
||||
formData.set("cat_name", getRouteName())
|
||||
await updateRoute(formData)
|
||||
}
|
||||
}
|
||||
let catId = urlParams().get("cat_id")
|
||||
formData.set("cat_id", catId)
|
||||
formData.set("cat_name", getRouteName())
|
||||
await updateRoute(formData)
|
||||
})
|
||||
|
||||
document.querySelector(`.unsafe-action`).after(sendButton)
|
||||
}
|
||||
|
||||
function showUnknownPoints() {
|
||||
|
Loading…
Reference in New Issue
Block a user