refactor
This commit is contained in:
parent
0f8af9b014
commit
e963a3e179
35
main.js
35
main.js
@ -1859,7 +1859,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function prettifyRouteBuildPage() {
|
||||
function changeColumnWidthForRouteBuildPage() {
|
||||
let styles = `
|
||||
#content table table {
|
||||
td:nth-child(2) {
|
||||
@ -1884,11 +1884,22 @@
|
||||
}
|
||||
`
|
||||
addStylesToHead(styles)
|
||||
}
|
||||
|
||||
function hideDescriptionFromRouteBuildPage() {
|
||||
document.querySelectorAll(`#content > form > table > tbody > tr:is(:nth-child(3), :nth-child(6)) `).forEach(el => el.remove())
|
||||
}
|
||||
|
||||
function hideStartRowFromRouteBuildPage() {
|
||||
document.querySelector(`#content table table tr:nth-child(2) `).remove()
|
||||
}
|
||||
|
||||
function prettifyRouteBuildPage() {
|
||||
changeColumnWidthForRouteBuildPage()
|
||||
hideDescriptionFromRouteBuildPage()
|
||||
hideStartRowFromRouteBuildPage()
|
||||
}
|
||||
|
||||
function matchNumberFromSelect(select) {
|
||||
return [...document.querySelector(select).options].reduce(
|
||||
(res, el) => ({ ...res, [el.textContent.match(/(?<=^\s*#)\d+/g)?.[0]]: el.value }),
|
||||
@ -1904,13 +1915,7 @@
|
||||
document.querySelector(`${select} option:last-child`).scrollIntoView()
|
||||
}
|
||||
|
||||
function prettifyRouteEditPage() {
|
||||
document.querySelectorAll(`textarea:is([name="track[comment_int]"], [name="track[comment_ext]"])`).forEach(el => {
|
||||
el.rows = 1
|
||||
})
|
||||
|
||||
document.querySelectorAll(`table tr:is(:nth-child(3), :nth-child(4), :nth-child(5))`).forEach(el => el.classList.add("hidden"))
|
||||
|
||||
function createPointsInpitForRouteEditPage() {
|
||||
let addPointsContainer = document.createElement("div")
|
||||
|
||||
let pointInput = document.createElement("input")
|
||||
@ -2001,6 +2006,16 @@
|
||||
`)
|
||||
}
|
||||
|
||||
function prettifyRouteEditPage() {
|
||||
document.querySelectorAll(`textarea:is([name="track[comment_int]"], [name="track[comment_ext]"])`).forEach(el => {
|
||||
el.rows = 1
|
||||
})
|
||||
|
||||
document.querySelectorAll(`table tr:is(:nth-child(3), :nth-child(4), :nth-child(5))`).forEach(el => el.classList.add("hidden"))
|
||||
|
||||
createPointsInpitForRouteEditPage()
|
||||
}
|
||||
|
||||
function toggleStagePageRows(rows) {
|
||||
let showIndex = [0, 3]
|
||||
let to = rows.findIndex(el => el.querySelector("th")?.textContent.trim() == "Бонусы")
|
||||
@ -2011,7 +2026,7 @@
|
||||
toggleRows(rows, to, rows.length, 1, [])
|
||||
}
|
||||
|
||||
function prettifyRouteStagesPage() {
|
||||
function hideUselessRowsFromRouteStagesPage() {
|
||||
let styles = `
|
||||
tr.collapsed {
|
||||
display: block;
|
||||
@ -2190,7 +2205,7 @@
|
||||
}
|
||||
|
||||
if (isRouteStagesPage()) {
|
||||
prettifyRouteStagesPage()
|
||||
hideUselessRowsFromRouteStagesPage()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user