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