| 66 | }; |
| 67 | |
| 68 | const cleanupLog = (atBottom: boolean): void => { |
| 69 | if (!logMonitorEl) return; |
| 70 | while (logMonitorEl.childElementCount > 100 && logMonitorEl.firstElementChild) { |
| 71 | logMonitorEl.removeChild(logMonitorEl.firstElementChild); |
| 72 | } |
| 73 | if (atBottom) logMonitorEl.scrollTop = logMonitorEl.scrollHeight; |
| 74 | else if (logMonitorEl.parentElement) logMonitorEl.parentElement.style.cssText = 'border-bottom: 2px solid var(--highlight-color);'; |
| 75 | const elWarn = document.getElementById('logWarnings'); |
| 76 | const elErr = document.getElementById('logErrors'); |
| 77 | const modenUIBtn = document.getElementById('btn_console'); |
| 78 | if (elWarn) elWarn.innerText = String(logWarnings); |
| 79 | if (elErr) elErr.innerText = String(logErrors); |
| 80 | if (modenUIBtn) modenUIBtn.setAttribute('error-count', logErrors > 0 ? String(logErrors) : ''); |
| 81 | }; |
| 82 | |
| 83 | const txtGallery = document.getElementById('txt2img_gallery'); |
| 84 | if (txtGallery) txtGallery.style.height = window.opts.logmonitor_show ? '50vh' : '55vh'; |