Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function bridges3($section) {
let g = GREEN, r = RED, b = BLUE, o = ORANGE;
let colours = {
val: Colour.rainbow(8),
eo: [g,r,g,r,g,r,g],
prime: [g,g,r,g,r,g,r],
size: [b,b,o,o,o,o,o]
};
let $circles = $section.$$('circle');
function colour(x) {
$circles.forEach(function($c) {
let y = +$c.attr('data-value');
$c.css('fill', colours[x][y-2]); // -2 because no 0s and 1s
});
if (x === 'eo') $section.score('dropdown');
}
$section.$('select').change(colour);
$step.model.set('handshakeTable', function(n) {
let colours = Colour.rainbow($step.model.n);
function makePerson(x, y) {
let newX= (x>=y ? x+1 : x);
return ['<span style="background: ',
colours[y], '" class="person">', y+1, '</span> + <span style="background: ', colours[newX],
'" class="person">', newX + 1, '</span>'].join('');
}
return '' +
tabulate(makePerson, n-1, n).map(x => `${ x.join('') }`).join('') +
'<table class="handshakes grid"><tbody><tr></tr></tbody></table>';
});
}