From 3bc08d491e135d91970dd23d7cd1f07b5f354ff3 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Wed, 14 Oct 2026 14:31:22 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20remove=20checkbox=20selection=20?= =?UTF-8?q?=E2=80=94=20apply=20to=20all=20target=20domains=20in=20tag=20au?= =?UTF-8?q?tomatically?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/app.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/web/app.js b/web/app.js index 2096ba5..1d90da1 100644 --- a/web/app.js +++ b/web/app.js @@ -31,27 +31,31 @@ function renderGroups(data) { } var html = groups.map(function (g) { + var targetCount = g.domains.filter(function (d) { return d !== g.source; }).length; + var domainsHtml = g.domains.map(function (d) { var isSource = (d === g.source); if (isSource) { return '
  • ' + esc(d) + ' SOURCE
  • '; } - return '
  • '; + return '
  • ' + esc(d) + '
  • '; }).join(''); var noSource = !g.hasSource ? '
    No domain in this tag has headers yet. Set headers on one domain (via Zoraxy UI) to use it as the source.
    ' : ''; + var actions = g.hasSource + ? '' + + '' + : ''; + return ( '
    ' + '

    ' + esc(g.tag) + '

    ' + noSource + '' + - '
    ' + - '' + - '' + - '
    ' + + '
    ' + actions + '
    ' + '
    ' + '
    ' ); @@ -68,13 +72,12 @@ function loadGroups() { }); } -function getSelectedTargets(group) { +// Collect all target domains (all non-source domains in the tag). +function getTargets(group) { var targets = []; - var boxes = group.querySelectorAll('.target-cb'); - for (var i = 0; i < boxes.length; i++) { - if (boxes[i].checked) { - targets.push(boxes[i].getAttribute('data-domain')); - } + var items = group.querySelectorAll('.domain.target'); + for (var i = 0; i < items.length; i++) { + targets.push(items[i].textContent.trim()); } return targets; } @@ -82,11 +85,11 @@ function getSelectedTargets(group) { function applyGroup(group) { var tag = group.dataset.tag; var source = group.dataset.source; - var targets = getSelectedTargets(group); + var targets = getTargets(group); var resultEl = group.querySelector('.result'); if (!source) { showToast('No source domain with headers', 'error'); return; } - if (targets.length === 0) { showToast('No target domains selected', 'error'); return; } + if (targets.length === 0) { showToast('No target domains in this tag', 'error'); return; } resultEl.textContent = 'Applying...'; $.cjax({ @@ -110,11 +113,11 @@ function applyGroup(group) { function removeGroup(group) { var source = group.dataset.source; - var targets = getSelectedTargets(group); + var targets = getTargets(group); var resultEl = group.querySelector('.result'); if (!source) { showToast('No source domain', 'error'); return; } - if (targets.length === 0) { showToast('No target domains selected', 'error'); return; } + if (targets.length === 0) { showToast('No target domains in this tag', 'error'); return; } resultEl.textContent = 'Removing...'; $.cjax({