Fixed fix server bug, fixed select deselect

This commit is contained in:
Sam 2026-11-03 00:00:17 +08:00
parent b1e34539ab
commit 0f0ab77327
2 changed files with 25 additions and 10 deletions

View File

@ -1102,17 +1102,32 @@
} }
var hadFocus = pick.input && document.activeElement == pick.input; var hadFocus = pick.input && document.activeElement == pick.input;
info.style.display = 'block'; info.style.display = 'block';
while (info.firstChild) var kids = [
info.removeChild(info.firstChild); el('button', { 'class': 'mkg-x', title: 'закрыть', onclick: function() { select(null); } }, [ '✕' ]),
info.appendChild(el('button', { 'class': 'mkg-x', title: 'закрыть', onclick: function() { select(null); } }, [ '✕' ])); el('h4', { text: kind + ': ' + n.label }),
info.appendChild(el('h4', { text: kind + ': ' + n.label })); el('table', {}, rows)
info.appendChild(el('table', {}, rows)); ];
if (act && act.saveServices && n.kind == 'group' && svcOf[n.label]) if (act && act.saveServices && n.kind == 'group' && svcOf[n.label])
info.appendChild(editor(svcOf[n.label])); kids.push(editor(svcOf[n.label]));
if (act && act.saveServices && n.kind == 'group' && poolOf[n.label]) if (act && act.saveServices && n.kind == 'group' && poolOf[n.label])
info.appendChild(poolEditor(poolOf[n.label])); kids.push(poolEditor(poolOf[n.label]));
if (act && n.kind == 'group' && L && showLive.checked && L.groups[n.id]) { var picking = act && n.kind == 'group' && L && showLive.checked && L.groups[n.id];
info.appendChild(chooser(n)); if (picking)
kids.push(chooser(n));
// the editors stay in place: taken out of the page, an open select closes and a field
// loses focus on every poll; the rest goes around them
Array.prototype.slice.call(info.childNodes).forEach(function(c) {
if (kids.indexOf(c) < 0)
info.removeChild(c);
});
var at = info.firstChild;
kids.forEach(function(c) {
if (c.parentNode == info)
at = c.nextSibling;
else
info.insertBefore(c, at);
});
if (picking) {
pick.list.scrollTop = pick.scroll; pick.list.scrollTop = pick.scroll;
if (hadFocus && pick.input) { if (hadFocus && pick.input) {
pick.input.focus(); pick.input.focus();

View File

@ -2013,7 +2013,7 @@ write_config() {
[ -n "${SERVICES:-}" ] && echo "SERVICES=$(q "$SERVICES")" [ -n "${SERVICES:-}" ] && echo "SERVICES=$(q "$SERVICES")"
for _s in ${SERVICES:-}; do for _s in ${SERVICES:-}; do
_k=$(svc_key "$_s") _k=$(svc_key "$_s")
for v in GEOSITE DOMAINS IPS VIA CHAIN; do for v in GEOSITE DOMAINS IPS VIA CHAIN SERVER PROVIDER; do
eval "_v=\${${_k}_$v:-}" eval "_v=\${${_k}_$v:-}"
[ -n "$_v" ] && echo "${_k}_$v=$(q "$_v")" [ -n "$_v" ] && echo "${_k}_$v=$(q "$_v")"
done done