From bcc9fd08c7331cae3ae2b1a2005f4e18b4f5df31 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Wed, 20 Jan 2016 20:57:26 +0000 Subject: [PATCH] Fixed WK link url generation for radicals. --- static/quiz_item.coffee | 4 ++-- static/quiz_item.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/static/quiz_item.coffee b/static/quiz_item.coffee index 58bf455..16ea5c7 100644 --- a/static/quiz_item.coffee +++ b/static/quiz_item.coffee @@ -29,6 +29,7 @@ refreshQuestion = () -> $("#question-image").show() else $("#question-area").text(selection['question']); + document.getElementById('view-on-wk').href ="https://www.wanikani.com/radicals/" + selection['answer'] else if(selection['item_type'] == 'kanji') document.body.style.backgroundColor = "deeppink"; @@ -41,8 +42,7 @@ 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'] + document.getElementById('view-on-wk').href ="https://www.wanikani.com/" + selection['item_type'] + "/" + selection['question'] updateQuizItemStats = () -> $('#radical-num').text(sessionStorage.getItem('radical_count')); diff --git a/static/quiz_item.js b/static/quiz_item.js index 1fb0c51..5e607dd 100644 --- a/static/quiz_item.js +++ b/static/quiz_item.js @@ -9,7 +9,7 @@ selection = null; refreshQuestion = function() { - var input_element, items, urlForType; + var input_element, items; if (sessionStorage.getItem('user_items')) { items = JSON.parse(sessionStorage.getItem('user_items')); if (linearMode) { @@ -39,6 +39,7 @@ } else { $("#question-area").text(selection['question']); } + return document.getElementById('view-on-wk').href = "https://www.wanikani.com/radicals/" + selection['answer']; } else { if (selection['item_type'] === 'kanji') { document.body.style.backgroundColor = "deeppink"; @@ -53,9 +54,8 @@ $("#kana").attr("placeholder", "かな"); wanakana.bind(input_element); } + return document.getElementById('view-on-wk').href = "https://www.wanikani.com/" + selection['item_type'] + "/" + selection['question']; } - urlForType = selection['item_type'] === 'radical' ? 'radicals' : selection['item_type']; - return document.getElementById('view-on-wk').href = "https://www.wanikani.com/" + urlForType + "/" + selection['question']; } };