diff options
Diffstat (limited to 'genome-list.mjs')
-rw-r--r-- | genome-list.mjs | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/genome-list.mjs b/genome-list.mjs index 8969a8c..ddb5361 100644 --- a/genome-list.mjs +++ b/genome-list.mjs @@ -1,13 +1,14 @@ class GenomeList { constructor(elt) { this.genomes = []; - this.elt = elt; + this.elt = elt } push(genome) { this.genomes.push(genome) - this.elt.appendChild(genome.elt) - window.genome = genome + const li = document.createElement('li') + li.appendChild(genome.elt) + this.historyElt.appendChild(li) genome.elt.scrollIntoView(false) } @@ -18,6 +19,31 @@ class GenomeList { return undefined } } + + get historyElt() { + if (this._historyElt === undefined) { + this._historyElt = document.createElement('ol') + this.elt.querySelector('.history').appendChild(this._historyElt) + } + return this._historyElt + } + + set initialGenome(genome) { + this.initialElt.appendChild(genome.elt) + } + + set finalGenome(genome) { + this.finalElt.appendChild(genome.elt) + this.finalElt.classList.remove('hidden') + } + + get initialElt() { + return this.elt.querySelector('.initial') + } + + get finalElt() { + return this.elt.querySelector('.final') + } } export default GenomeList |