summaryrefslogtreecommitdiff
path: root/js/spam.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/spam.js')
-rw-r--r--js/spam.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/js/spam.js b/js/spam.js
index 339f5be..0a99c80 100644
--- a/js/spam.js
+++ b/js/spam.js
@@ -398,20 +398,40 @@ function refreshSpam() {
// update the spam levels in the dataset
var nodes = force.nodes();
+ var updated = [];
nodes.forEach(function (node) {
if (node.userid in map_userSpam) {
- node.isSpam = map_userSpam[node.userid];
+ // only mark as updated if there is actually a change
+ if (node.isSpam !== map_userSpam[node.userid]) {
+ node.isSpam = map_userSpam[node.userid];
+ updated.push(node.userid);
+ }
} else {
console.log('New data is missing user', node.userid);
}
});
+ console.log('Updated spam rating for', updated.length, 'nodes');
// change the appearance of displayed elements
d3.select('#map').selectAll('.node')
.data(nodes, function (d) {
return d.userid;
})
- .attr('class', getNodeClasses);
+ .filter(function (d) {
+ return updated.indexOf(d.userid) >= 0;
+ })
+ .transition()
+ .duration(4000)
+ .attr('r', function (d) {
+ // make all nodes very visible
+ return Math.max(10, 4 * d.radius);
+ })
+ .attr('class', getNodeClasses)
+ .transition()
+ .duration(1000)
+ .attr('r', function (d) {
+ return d.radius;
+ });
});
}