diff --git a/console/ui/index.html b/console/ui/index.html index 1ae3b34..b9de252 100644 --- a/console/ui/index.html +++ b/console/ui/index.html @@ -15,6 +15,7 @@ + @@ -411,24 +412,6 @@ currentInvoke: null }; - function setText(id, value) { - document.getElementById(id).textContent = String(value); - } - - function showStatus(message, kind) { - const el = document.getElementById('status'); - el.style.display = 'block'; - el.className = 'status ' + (kind || ''); - el.textContent = message; - } - - function clearStatus() { - const el = document.getElementById('status'); - el.style.display = 'none'; - el.className = 'status'; - el.textContent = ''; - } - function parseMethods(v) { const items = String(v || '').split(',').map(s => s.trim().toUpperCase()).filter(Boolean); return items.length ? Array.from(new Set(items)) : ['GET']; @@ -527,34 +510,6 @@ } } - function h(v) { - return String(v == null ? '' : v) - .replaceAll('&', '&') - .replaceAll('<', '<') - .replaceAll('>', '>') - .replaceAll('"', '"') - .replaceAll("'", '''); - } - - function formatTimestamp(ts) { - if (!ts) return '—'; - var d = new Date(ts); - if (isNaN(d.getTime())) return String(ts); - return d.toLocaleString('ru-RU', { - year: 'numeric', - month: '2-digit', - day: '2-digit', - hour: '2-digit', - minute: '2-digit', - second: '2-digit' - }); - } - - function timestampCell(ts) { - var text = formatTimestamp(ts); - return '' + h(text) + ''; - } - function onLangChange() { var lang = document.getElementById('c-lang').value; var t = LANG_TEMPLATES[lang]; diff --git a/console/ui/js/ui.js b/console/ui/js/ui.js new file mode 100644 index 0000000..b7ba17d --- /dev/null +++ b/console/ui/js/ui.js @@ -0,0 +1,47 @@ +/* ui.js — UI-вспомогательные функции */ + +function setText(id, value) { + document.getElementById(id).textContent = String(value); +} + +function showStatus(message, kind) { + const el = document.getElementById('status'); + el.style.display = 'block'; + el.className = 'status ' + (kind || ''); + el.textContent = message; +} + +function clearStatus() { + const el = document.getElementById('status'); + el.style.display = 'none'; + el.className = 'status'; + el.textContent = ''; +} + +function h(v) { + return String(v == null ? '' : v) + .replaceAll('&', '&') + .replaceAll('<', '<') + .replaceAll('>', '>') + .replaceAll('"', '"') + .replaceAll("'", '''); +} + +function formatTimestamp(ts) { + if (!ts) return '—'; + var d = new Date(ts); + if (isNaN(d.getTime())) return String(ts); + return d.toLocaleString('ru-RU', { + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit' + }); +} + +function timestampCell(ts) { + var text = formatTimestamp(ts); + return '' + h(text) + ''; +}