make function local

This commit is contained in:
Zhora Shalyapin 2025-03-20 14:27:18 +00:00
parent cf7a722429
commit 3958a610f9

34
main.js
View File

@ -1859,7 +1859,8 @@
}
}
function changeColumnWidthForRouteBuildPage() {
function prettifyRouteBuildPage() {
function changeColumnWidth() {
let styles = `
#content table table {
td:nth-child(2) {
@ -1886,26 +1887,29 @@
addStylesToHead(styles)
}
function hideDescriptionFromRouteBuildPage() {
function hideDescription() {
document.querySelectorAll(`#content > form > table > tbody > tr:is(:nth-child(3), :nth-child(6)) `).forEach(el => el.remove())
}
function hideStartRowFromRouteBuildPage() {
function hideStartRow() {
document.querySelector(`#content table table tr:nth-child(2) `).remove()
}
function getRows() {
return [...document.querySelectorAll(`#content > form > table > tbody > tr:nth-child(3) tr`)]
}
function useColspanForFinishWarning() {
let rows = [...document.querySelectorAll(`#content > form > table > tbody > tr:nth-child(3) tr`)]
let rows = getRows()
let finishRow = rows.find(el => el.querySelector(`td`)?.textContent.trim() == "Финиш маршрута")
finishRow.querySelectorAll(`td:not(:nth-child(2))`).forEach(el => el.remove())
finishRow.querySelector(`td`).colSpan = 4
}
function prettifyRouteBuildPage() {
changeColumnWidthForRouteBuildPage()
hideDescriptionFromRouteBuildPage()
hideStartRowFromRouteBuildPage()
changeColumnWidth()
hideDescription()
hideStartRow()
useColspanForFinishWarning()
}
@ -1924,7 +1928,8 @@
document.querySelector(`${select} option:last-child`).scrollIntoView()
}
function createPointsInpitForRouteEditPage() {
function prettifyRouteEditPage() {
function createPointsInpit() {
let addPointsContainer = document.createElement("div")
let pointInput = document.createElement("input")
@ -2015,20 +2020,19 @@
`)
}
function makeTextareasOneRowInRouteEditPage() {
function makeTextareasOneRow() {
document.querySelectorAll(`textarea:is([name="track[comment_int]"], [name="track[comment_ext]"])`).forEach(el => {
el.rows = 1
})
}
function hideRedundantRowsInRouteEditPage() {
function hideRedundantRows() {
document.querySelectorAll(`table tr:is(:nth-child(3), :nth-child(4), :nth-child(5))`).forEach(el => el.classList.add("hidden"))
}
function prettifyRouteEditPage() {
makeTextareasOneRowInRouteEditPage()
hideRedundantRowsInRouteEditPage()
createPointsInpitForRouteEditPage()
makeTextareasOneRow()
hideRedundantRows()
createPointsInpit()
}
function toggleStagePageRows(rows) {