Files
ReZygisk/webroot/js/smallPageDesabler.js
RainyXeon 98743e8523 add: new ui for error history page
remove: modal support (initial)
2024-11-12 14:12:53 +07:00

26 lines
1.1 KiB
JavaScript

export function smallPageDisabler(page_name, new_page, custom_page) {
const navbar_data_tag = document.getElementById('cache-navbar-previous')
const small_panel_data_tag = document.getElementById('cache-page-small-previous')
document.getElementById(`small_panel_${page_name}`).classList.remove('show')
small_panel_data_tag.removeAttribute('content')
const previous = navbar_data_tag.getAttribute('content')
/* INFO: Disable icon on old state */
const pre_input = document.getElementById(`n_${previous}`)
const pre_background = document.getElementById(`nibg_${previous}`)
pre_input.removeAttribute('checked')
pre_background.classList.remove('show')
/* INFO: Enable icon on new state */
const curr_input = document.getElementById(`n_${new_page}`)
const i_background = document.getElementById(`nibg_${new_page}`)
document.getElementById(`panel_${new_page}`).classList.toggle('show')
curr_input.setAttribute('checked', '')
i_background.classList.toggle('show')
navbar_data_tag.setAttribute('content', custom_page ? custom_page : 'settings')
}