parent
10c45908d4
commit
49f87908c4
18
index.html
18
index.html
@ -49,14 +49,16 @@
|
||||
</svg>
|
||||
</div>
|
||||
<div class="store">
|
||||
<div
|
||||
class="card"
|
||||
v-for="item_idx in store.items"
|
||||
v-bind:class="{selected: item_idx == store.selected}"
|
||||
v-bind:style="{visibility: store_card_visible(item_idx) ? 'visible' : 'hidden'}"
|
||||
v-on:click="store_select(item_idx)"
|
||||
>
|
||||
<span>{{ store_text(item_idx) }}</span>
|
||||
<div v-for="row in reduced_store">
|
||||
<div
|
||||
class="card"
|
||||
v-for="item_idx in row"
|
||||
v-bind:class="{selected: item_idx == store.selected}"
|
||||
v-bind:style="{visibility: store_card_visible(item_idx) ? 'visible' : 'hidden'}"
|
||||
v-on:click="store_select(item_idx)"
|
||||
>
|
||||
<span>{{ store_text(item_idx) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
19
quiz.js
19
quiz.js
@ -277,6 +277,25 @@ var app = new Vue({
|
||||
solution_correct: function() {
|
||||
return this.solution_revealed && this.all_inserted && !this.incorrects.includes(true);
|
||||
},
|
||||
reduced_store: function() {
|
||||
let width = 2;
|
||||
let reduced_list = [];
|
||||
for (let row_begin = 0; row_begin < this.store.items.length; row_begin += width) {
|
||||
let row = [];
|
||||
let needed = false;
|
||||
for (let cell = row_begin; cell < this.store.items.length && cell - row_begin < width; cell++) {
|
||||
let item_idx = this.store.items[cell];
|
||||
row.push(item_idx);
|
||||
if (this.store_card_visible(item_idx)) {
|
||||
needed = true;
|
||||
}
|
||||
}
|
||||
if (needed) {
|
||||
reduced_list.push(row);
|
||||
}
|
||||
}
|
||||
return reduced_list;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
store_text: function(idx) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user