Added a button to view the WaniKani page for the current question item.
This commit is contained in:
parent
6c298c2c08
commit
8491d93ff0
@ -41,6 +41,8 @@ refreshQuestion = () ->
|
||||
else
|
||||
$("#kana").attr("placeholder", "かな")
|
||||
wanakana.bind(input_element);
|
||||
urlForType = if selection['item_type'] == 'radical' then 'radicals' else selection['item_type']
|
||||
document.getElementById('view-on-wk').href ="https://www.wanikani.com/" + urlForType + "/" + selection['question']
|
||||
|
||||
updateQuizItemStats = () ->
|
||||
$('#radical-num').text(sessionStorage.getItem('radical_count'));
|
||||
|
@ -9,7 +9,7 @@
|
||||
selection = null;
|
||||
|
||||
refreshQuestion = function() {
|
||||
var input_element, items;
|
||||
var input_element, items, urlForType;
|
||||
if (sessionStorage.getItem('user_items')) {
|
||||
items = JSON.parse(sessionStorage.getItem('user_items'));
|
||||
if (linearMode) {
|
||||
@ -35,9 +35,9 @@
|
||||
wanakana.unbind(input_element);
|
||||
if (selection['question'].indexOf('http') >= 0) {
|
||||
$("#question-image").attr("src", selection['question']);
|
||||
return $("#question-image").show();
|
||||
$("#question-image").show();
|
||||
} else {
|
||||
return $("#question-area").text(selection['question']);
|
||||
$("#question-area").text(selection['question']);
|
||||
}
|
||||
} else {
|
||||
if (selection['item_type'] === 'kanji') {
|
||||
@ -48,12 +48,14 @@
|
||||
$("#question-area").text(selection['question']);
|
||||
if (selection['answer_type'] === 'eng') {
|
||||
$("#kana").attr("placeholder", "Meaning");
|
||||
return wanakana.unbind(input_element);
|
||||
wanakana.unbind(input_element);
|
||||
} else {
|
||||
$("#kana").attr("placeholder", "かな");
|
||||
return wanakana.bind(input_element);
|
||||
wanakana.bind(input_element);
|
||||
}
|
||||
}
|
||||
urlForType = selection['item_type'] === 'radical' ? 'radicals' : selection['item_type'];
|
||||
return document.getElementById('view-on-wk').href = "https://www.wanikani.com/" + urlForType + "/" + selection['question'];
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -101,6 +101,14 @@
|
||||
<button class="btn btn-default btn-lg" id="get-help">Reveal Answer(s)</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<br />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
<a class="btn btn-default btn-lg" href="" id="view-on-wk">View on WaniKani</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{ url_for('static', filename='wanakana.min.js')}}"></script>
|
||||
<script defer src="{{ url_for('static', filename='quiz_item.js')}}"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user