mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: webui-6
This commit is contained in:
parent
4ccec05186
commit
8d5c736975
@ -212,10 +212,13 @@ function aprilFoolsEgg(node: Element) {
|
|||||||
const errMsg = await window.llonebot.getError()
|
const errMsg = await window.llonebot.getError()
|
||||||
|
|
||||||
if (!errMsg) {
|
if (!errMsg) {
|
||||||
|
//@ts-ignore 等待修复
|
||||||
errDom.classList.remove('show')
|
errDom.classList.remove('show')
|
||||||
} else {
|
} else {
|
||||||
|
//@ts-ignore 等待修复
|
||||||
errDom.classList.add('show')
|
errDom.classList.add('show')
|
||||||
}
|
}
|
||||||
|
//@ts-ignore 等待修复
|
||||||
errCodeDom.innerHTML = errMsg
|
errCodeDom.innerHTML = errMsg
|
||||||
}
|
}
|
||||||
showError().then()
|
showError().then()
|
||||||
@ -281,8 +284,8 @@ function aprilFoolsEgg(node: Element) {
|
|||||||
ob11Config[type].push('');
|
ob11Config[type].push('');
|
||||||
}
|
}
|
||||||
const initReverseHost = (type: string, doc: Document = document) => {
|
const initReverseHost = (type: string, doc: Document = document) => {
|
||||||
const hostContainerDom = doc.body.querySelector(`#config-ob11-${type}-list`)
|
const hostContainerDom = doc.body?.querySelector(`#config-ob11-${type}-list`);
|
||||||
;[...hostContainerDom.childNodes].forEach((dom) => dom.remove())
|
[...hostContainerDom.childNodes].forEach((dom) => dom.remove());
|
||||||
buildHostList(ob11Config[type], type).forEach((dom) => {
|
buildHostList(ob11Config[type], type).forEach((dom) => {
|
||||||
hostContainerDom?.appendChild(dom);
|
hostContainerDom?.appendChild(dom);
|
||||||
})
|
})
|
||||||
@ -313,13 +316,14 @@ function aprilFoolsEgg(node: Element) {
|
|||||||
doc.querySelectorAll('setting-switch[data-config-key]').forEach((dom: Element) => {
|
doc.querySelectorAll('setting-switch[data-config-key]').forEach((dom: Element) => {
|
||||||
dom.addEventListener('click', () => {
|
dom.addEventListener('click', () => {
|
||||||
const active = dom.getAttribute('is-active') === undefined
|
const active = dom.getAttribute('is-active') === undefined
|
||||||
|
//@ts-ignore 等待修复
|
||||||
setConfig(dom.dataset.configKey, active)
|
setConfig(dom.dataset.configKey, active)
|
||||||
|
|
||||||
if (active) dom.setAttribute('is-active', '')
|
if (active) dom.setAttribute('is-active', '')
|
||||||
else dom.removeAttribute('is-active')
|
else dom.removeAttribute('is-active')
|
||||||
|
//@ts-ignore 等待修复
|
||||||
if (!isEmpty(dom.dataset.controlDisplayId)) {
|
if (!isEmpty(dom.dataset.controlDisplayId)) {
|
||||||
|
//@ts-ignore 等待修复
|
||||||
const displayDom = document.querySelector(`#${dom.dataset.controlDisplayId}`)
|
const displayDom = document.querySelector(`#${dom.dataset.controlDisplayId}`)
|
||||||
if (active) displayDom?.removeAttribute('is-hidden')
|
if (active) displayDom?.removeAttribute('is-hidden')
|
||||||
else displayDom?.setAttribute('is-hidden', '')
|
else displayDom?.setAttribute('is-hidden', '')
|
||||||
@ -333,6 +337,7 @@ function aprilFoolsEgg(node: Element) {
|
|||||||
.forEach((dom: Element) => {
|
.forEach((dom: Element) => {
|
||||||
dom.addEventListener('input', () => {
|
dom.addEventListener('input', () => {
|
||||||
const Type = dom.getAttribute('type')
|
const Type = dom.getAttribute('type')
|
||||||
|
//@ts-ignore 等待修复
|
||||||
const configKey = dom.dataset.configKey
|
const configKey = dom.dataset.configKey
|
||||||
const configValue = Type === 'number' ? (parseInt((dom as HTMLInputElement).value) >= 1 ? parseInt((dom as HTMLInputElement).value) : 1) : (dom as HTMLInputElement).value
|
const configValue = Type === 'number' ? (parseInt((dom as HTMLInputElement).value) >= 1 ? parseInt((dom as HTMLInputElement).value) : 1) : (dom as HTMLInputElement).value
|
||||||
|
|
||||||
@ -342,7 +347,8 @@ function aprilFoolsEgg(node: Element) {
|
|||||||
|
|
||||||
// 下拉框
|
// 下拉框
|
||||||
doc.querySelectorAll('ob-setting-select[data-config-key]').forEach((dom: Element) => {
|
doc.querySelectorAll('ob-setting-select[data-config-key]').forEach((dom: Element) => {
|
||||||
dom.addEventListener('selected', (e: CustomEvent) => {
|
dom?.addEventListener('selected', (e: CustomEvent) => {
|
||||||
|
//@ts-ignore 等待修复
|
||||||
const configKey = dom.dataset.configKey
|
const configKey = dom.dataset.configKey
|
||||||
const configValue = e.detail.value
|
const configValue = e.detail.value
|
||||||
|
|
||||||
@ -364,6 +370,7 @@ function aprilFoolsEgg(node: Element) {
|
|||||||
view.appendChild(node)
|
view.appendChild(node)
|
||||||
})
|
})
|
||||||
// 更新逻辑
|
// 更新逻辑
|
||||||
|
//@ts-ignore 等待修复
|
||||||
async function checkVersionFunc(ResultVersion: CheckVersion) {
|
async function checkVersionFunc(ResultVersion: CheckVersion) {
|
||||||
const titleDom = view.querySelector<HTMLSpanElement>('#llonebot-update-title')!
|
const titleDom = view.querySelector<HTMLSpanElement>('#llonebot-update-title')!
|
||||||
const buttonDom = view.querySelector<HTMLButtonElement>('#llonebot-update-button')!
|
const buttonDom = view.querySelector<HTMLButtonElement>('#llonebot-update-button')!
|
||||||
@ -411,4 +418,5 @@ function aprilFoolsEgg(node: Element) {
|
|||||||
window.llonebot.setConfig(true, config)
|
window.llonebot.setConfig(true, config)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export { onSettingWindowCreated }
|
}
|
||||||
|
export { onSettingWindowCreated }
|
Loading…
x
Reference in New Issue
Block a user