diff --git a/static/quiz_item.coffee b/static/quiz_item.coffee index bfa4ad7..58bf455 100644 --- a/static/quiz_item.coffee +++ b/static/quiz_item.coffee @@ -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')); diff --git a/static/quiz_item.js b/static/quiz_item.js index ffb1432..1fb0c51 100644 --- a/static/quiz_item.js +++ b/static/quiz_item.js @@ -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']; } }; diff --git a/templates/quiz.html b/templates/quiz.html index 65a7d7c..d0a511a 100644 --- a/templates/quiz.html +++ b/templates/quiz.html @@ -101,6 +101,14 @@ +