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({