Added stats for how many potential review items there are.

This commit is contained in:
neviyn 2015-10-05 16:48:29 +01:00
parent a8e4e3e334
commit 634454edb6
2 changed files with 16 additions and 1 deletions

View File

@ -5,7 +5,14 @@ refreshQuestion = () ->
dataType: 'json', dataType: 'json',
success: (e) -> success: (e) ->
sessionStorage.setItem('user_items', JSON.stringify(e['item_list'])) sessionStorage.setItem('user_items', JSON.stringify(e['item_list']))
sessionStorage.setItem('radical_count', e['radical_count'])
sessionStorage.setItem('kanji_count', e['kanji_count'])
sessionStorage.setItem('vocabulary_count', e['vocabulary_count'])
refreshQuestion() refreshQuestion()
if($('#radical-num').text() == '')
$('#radical-num').text(sessionStorage.getItem('radical_count'));
$('#kanji-num').text(sessionStorage.getItem('kanji_count'));
$('#vocab-num').text(sessionStorage.getItem('vocabulary_count'));
if(sessionStorage.getItem('user_items')) if(sessionStorage.getItem('user_items'))
items = JSON.parse(sessionStorage.getItem('user_items')) items = JSON.parse(sessionStorage.getItem('user_items'))
selection = items[Math.floor(Math.random() * items.length)] selection = items[Math.floor(Math.random() * items.length)]

View File

@ -8,6 +8,14 @@
</a> </a>
</div> </div>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-option-horizontal"></span></a>
<ul class="dropdown-menu" aria-labelledby="dLabel">
<li><span id="radical-num"></span> Radicals</li>
<li><span id="kanji-num"></span> Kanji</li>
<li><span id="vocab-num"></span> Vocabulary</li>
</ul>
</li>
<li> <li>
<button id="api-refresh" type="submit" class="btn btn-default navbar-btn" aria-label="Refresh API"> <button id="api-refresh" type="submit" class="btn btn-default navbar-btn" aria-label="Refresh API">
<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>