|
2 | 2 | (function() {
|
3 | 3 | let index = 1, data = [], labels = null, invalidLabels = true, selected = null;
|
4 | 4 | const tbody = document.getElementsByTagName('tbody')[0];
|
5 |
| - |
| 5 | + |
| 6 | + const adjectives = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"]; |
| 7 | + const colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]; |
| 8 | + const nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"]; |
| 9 | + const l1 = adjectives.length, l2 = colours.length, l3 = nouns.length; |
| 10 | + const nts = (n) => Math.round(n / 100) |
| 11 | + |
6 | 12 | function run(n = 1000) { if (data.length) clear(); add(n); }
|
7 | 13 | function runlots() { run(10000) }
|
8 | 14 | function add(n = 1000) {
|
9 |
| - const adjectives = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"]; |
10 |
| - const colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"]; |
11 |
| - const nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"]; |
12 |
| - const l1 = adjectives.length, l2 = colours.length, l3 = nouns.length; |
13 |
| - const nts = {1000: 5, 10000: 125}, nt = nts[n]; |
| 15 | + const nt = nts(n); |
14 | 16 | let i, j = 0, r1, r2, r3;;
|
15 | 17 |
|
16 |
| - const itemTemplates = document.getElementById('itemTemplate').content.cloneNode(true); |
| 18 | + const itemTemplates = document.getElementById(`t${n}`).content // .cloneNode(true); |
17 | 19 | if (itemTemplates.children.length < nt) {
|
18 | 20 | const itemTemplate = itemTemplates.firstElementChild;
|
19 | 21 | while (nt >= itemTemplates.children.length * 2) itemTemplates.appendChild(itemTemplates.cloneNode(true));
|
|
0 commit comments